Variable can be declared 'const'.

This commit is contained in:
Roman Telezhynskyi 2024-02-19 18:09:56 +02:00
parent 3027ddb49c
commit 0adb49a427
338 changed files with 2969 additions and 2920 deletions

View File

@ -53,7 +53,7 @@ VPCarrouselPiece::VPCarrouselPiece(const VPPiecePtr &piece, QListWidget *parent)
{
SCASSERT(m_piece != nullptr)
const int width = 120 - 8;
QString clippedText = QFontMetrics(font()).elidedText(piece->GetName(), Qt::ElideRight, width);
QString const clippedText = QFontMetrics(font()).elidedText(piece->GetName(), Qt::ElideRight, width);
RefreshPieceIcon();
setText(clippedText);
setToolTip(piece->GetName());
@ -68,7 +68,7 @@ auto VPCarrouselPiece::GetPiece() const -> VPPiecePtr
//---------------------------------------------------------------------------------------------------------------------
void VPCarrouselPiece::RefreshSelection()
{
VPPiecePtr piece = GetPiece();
VPPiecePtr const piece = GetPiece();
if (not piece.isNull())
{
setSelected(piece->IsSelected());
@ -84,18 +84,18 @@ void VPCarrouselPiece::RefreshPieceIcon()
//---------------------------------------------------------------------------------------------------------------------
auto VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const -> QIcon
{
VPPiecePtr piece = GetPiece();
VPPiecePtr const piece = GetPiece();
if (piece.isNull())
{
return {};
}
QRectF boundingRect = piece->DetailBoundingRect();
qreal canvasSize = qMax(boundingRect.height(), boundingRect.width());
QRectF canvas = QRectF(0, 0, canvasSize, canvasSize);
QRectF const boundingRect = piece->DetailBoundingRect();
qreal const canvasSize = qMax(boundingRect.height(), boundingRect.width());
QRectF const canvas = QRectF(0, 0, canvasSize, canvasSize);
qreal dx = canvas.center().x() - boundingRect.center().x();
qreal dy = canvas.center().y() - boundingRect.center().y();
qreal const dx = canvas.center().x() - boundingRect.center().x();
qreal const dy = canvas.center().y() - boundingRect.center().y();
QVector<QIcon::Mode> iconModes;
iconModes.append(QIcon::Normal);
@ -119,12 +119,12 @@ auto VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
int spacing = 2;
int const spacing = 2;
painter.translate(spacing, spacing);
qreal scaleFactorX = canvasSize * 100 / (size.width() - spacing * 2) / 100;
qreal scaleFactorY = canvasSize * 100 / (size.height() - spacing * 2) / 100;
qreal const scaleFactorX = canvasSize * 100 / (size.width() - spacing * 2) / 100;
qreal const scaleFactorY = canvasSize * 100 / (size.height() - spacing * 2) / 100;
painter.scale(1. / scaleFactorX, 1. / scaleFactorY);
painter.setPen(QPen(style.CarrouselPieceColor(), 0.8 * qMax(scaleFactorX, scaleFactorY)));
@ -141,7 +141,7 @@ auto VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const
: style.CarrouselPieceForegroundColor()));
bool togetherWithNotches = false;
VPLayoutPtr pieceLayout = piece->Layout();
VPLayoutPtr const pieceLayout = piece->Layout();
if (not pieceLayout.isNull())
{
togetherWithNotches = pieceLayout->LayoutSettings().IsBoundaryTogetherWithNotches();

View File

@ -168,7 +168,7 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions)
return;
}
VPLayoutPtr layout = m_carrousel->Layout().toStrongRef();
VPLayoutPtr const layout = m_carrousel->Layout().toStrongRef();
if (layout.isNull())
{
return;
@ -177,11 +177,11 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions)
// starts the dragging
auto *drag = new QDrag(this);
auto *mimeData = new VPMimeDataPiece(layout->Uuid());
VPPiecePtr piece = pieceItem->GetPiece();
VPPiecePtr const piece = pieceItem->GetPiece();
mimeData->SetPiecePtr(piece);
QIcon pieceIcon = pieceItem->CreatePieceIcon(QSize(120, 120), true);
QPixmap pixmap;
QIcon const pieceIcon = pieceItem->CreatePieceIcon(QSize(120, 120), true);
QPixmap const pixmap;
if (!pieceIcon.isNull())
{
pieceIcon.pixmap(QSize(120, 120));
@ -194,7 +194,7 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions)
m_carrousel->Refresh();
piece->SetSelected(false);
VPLayoutPtr pieceLayout = piece->Layout();
VPLayoutPtr const pieceLayout = piece->Layout();
if (not pieceLayout.isNull())
{
emit pieceLayout->PieceSelectionChanged(piece);
@ -222,8 +222,8 @@ void VPCarrouselPieceList::contextMenuEvent(QContextMenuEvent *event)
auto *pieceItem = dynamic_cast<VPCarrouselPiece *>(_item);
SCASSERT(pieceItem != nullptr)
VPPiecePtr piece = pieceItem->GetPiece();
VPLayoutPtr layout = piece->Layout();
VPPiecePtr const piece = pieceItem->GetPiece();
VPLayoutPtr const layout = piece->Layout();
if (piece.isNull() || layout.isNull())
{
@ -279,11 +279,11 @@ void VPCarrouselPieceList::contextMenuEvent(QContextMenuEvent *event)
if (selectedAction == moveAction)
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
piece->ClearTransformations();
QRectF rect = sheet->GetMarginsRect();
QRectF const rect = sheet->GetMarginsRect();
piece->SetPosition(QPointF(rect.topLeft().x() + 1, rect.topLeft().y() + 1));
piece->SetZValue(1.0);
auto *command = new VPUndoMovePieceOnSheet(layout->GetFocusedSheet(), piece);

View File

@ -239,7 +239,7 @@ void PuzzlePreferencesLayoutPage::ConvertPaperSize()
const qreal newTileTopMargin = UnitConvertor(tileTopMargin, m_oldLayoutUnit, layoutUnit);
const qreal newTileBottomMargin = UnitConvertor(tileBottomMargin, m_oldLayoutUnit, layoutUnit);
qreal newGap = UnitConvertor(ui->doubleSpinBoxPiecesGap->value(), m_oldLayoutUnit, layoutUnit);
qreal const newGap = UnitConvertor(ui->doubleSpinBoxPiecesGap->value(), m_oldLayoutUnit, layoutUnit);
m_oldLayoutUnit = layoutUnit;
CorrectPaperDecimals();
@ -555,7 +555,7 @@ void PuzzlePreferencesLayoutPage::CorrectPaperDecimals()
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesLayoutPage::SheetPaperSizeChanged()
{
bool portrait = ui->doubleSpinBoxSheetPaperHeight->value() > ui->doubleSpinBoxSheetPaperWidth->value();
bool const portrait = ui->doubleSpinBoxSheetPaperHeight->value() > ui->doubleSpinBoxSheetPaperWidth->value();
ui->toolButtonSheetPortraitOritation->blockSignals(true);
ui->toolButtonSheetPortraitOritation->setChecked(portrait);
@ -571,7 +571,7 @@ void PuzzlePreferencesLayoutPage::SheetPaperSizeChanged()
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesLayoutPage::TilePaperSizeChanged()
{
bool portrait = ui->doubleSpinBoxTilePaperHeight->value() > ui->doubleSpinBoxTilePaperWidth->value();
bool const portrait = ui->doubleSpinBoxTilePaperHeight->value() > ui->doubleSpinBoxTilePaperWidth->value();
ui->toolButtonTilePortraitOrientation->blockSignals(true);
ui->toolButtonTilePortraitOrientation->setChecked(portrait);
@ -627,7 +627,7 @@ void PuzzlePreferencesLayoutPage::SetTileMargins(const QMarginsF &value)
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesLayoutPage::SetPieceGap(qreal gap)
{
qreal value = UnitConvertor(gap, Unit::Px, LayoutUnit());
qreal const value = UnitConvertor(gap, Unit::Px, LayoutUnit());
ui->doubleSpinBoxPiecesGap->setValue(value);
CorrectPaperDecimals();
}

View File

@ -127,7 +127,7 @@ void PuzzlePreferencesPathPage::EditPath()
}
bool usedNotExistedDir = false;
QDir directory(path);
QDir const directory(path);
if (not directory.exists())
{
usedNotExistedDir = directory.mkpath(QChar('.'));

View File

@ -92,7 +92,7 @@ void DialogPuzzlePreferences::showEvent(QShowEvent *event)
}
// do your init stuff here
QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
QSize const sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@ -180,6 +180,6 @@ void DialogPuzzlePreferences::PageChanged(QListWidgetItem *current, QListWidgetI
{
current = previous;
}
int rowIndex = ui->contentsWidget->row(current);
int const rowIndex = ui->contentsWidget->row(current);
ui->pagesWidget->setCurrentIndex(rowIndex);
}

View File

@ -426,7 +426,7 @@ void DialogSaveManualLayout::Save()
if (QFile::exists(name))
{
QMessageBox::StandardButton res = QMessageBox::question(
QMessageBox::StandardButton const res = QMessageBox::question(
this, tr("Name conflict"),
tr("Folder already contain file with name %1. Rewrite all conflict file names?").arg(name),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);

View File

@ -228,14 +228,14 @@ void VPPiece::SetPosition(QPointF point)
//---------------------------------------------------------------------------------------------------------------------
auto VPPiece::GetPosition() -> QPointF
{
QTransform matrix = GetMatrix();
QTransform const matrix = GetMatrix();
return {matrix.dx(), matrix.dy()};
}
//---------------------------------------------------------------------------------------------------------------------
void VPPiece::RotateToGrainline(const VPTransformationOrigon &origin)
{
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (not IsGrainlineEnabled() || sheet.isNull())
{
return;

View File

@ -293,10 +293,10 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
setCursor(Qt::OpenHandCursor);
emit HideTransformationHandles(false);
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (not piece.isNull())
{
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (not layout.isNull())
{
if (layout->LayoutSettings().GetStickyEdges() && m_hasStickyPosition)
@ -332,13 +332,13 @@ void VPGraphicsPiece::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -492,7 +492,7 @@ void VPGraphicsPiece::InitPieceLabelSVGFont(const QVector<QPointF> &labelShape,
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::InitPieceLabelOutlineFont(const QVector<QPointF> &labelShape, const VTextManager &tm)
{
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (piece.isNull())
{
return;
@ -508,7 +508,7 @@ void VPGraphicsPiece::InitPieceLabelOutlineFont(const QVector<QPointF> &labelSha
const qreal angle = -QLineF(labelShape.at(0), labelShape.at(1)).angle();
const QColor color = PieceColor();
const int maxLineWidth = tm.MaxLineWidthOutlineFont(static_cast<int>(dW));
qreal penWidth = VPApplication::VApp()->PuzzleSettings()->GetLayoutLineWidth();
qreal const penWidth = VPApplication::VApp()->PuzzleSettings()->GetLayoutLineWidth();
qreal dY = 0;
@ -609,7 +609,7 @@ void VPGraphicsPiece::InitGrainlineItem()
{
delete m_grainlineItem;
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (piece.isNull())
{
return;
@ -621,7 +621,7 @@ void VPGraphicsPiece::InitGrainlineItem()
m_grainlineItem->setPath(VLayoutPiece::GrainlinePath(piece->GetMappedGrainlineShape()));
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
QPen pen(PieceColor(), settings->GetLayoutLineWidth(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen const pen(PieceColor(), settings->GetLayoutLineWidth(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
m_grainlineItem->SetCustomPen(true);
m_grainlineItem->setPen(pen);
}
@ -738,13 +738,13 @@ void VPGraphicsPiece::PaintCuttingLine(QPainter *painter, const VPPiecePtr &piec
{
if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn())
{
QVector<VLayoutPoint> cuttingLinepoints = piece->GetMappedFullSeamAllowancePoints();
QVector<VLayoutPoint> const cuttingLinepoints = piece->GetMappedFullSeamAllowancePoints();
if (cuttingLinepoints.isEmpty())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -754,8 +754,8 @@ void VPGraphicsPiece::PaintCuttingLine(QPainter *painter, const VPPiecePtr &piec
{
const QVector<VLayoutPassmark> passmarks = piece->GetMappedPassmarks();
bool seamAllowance = piece->IsSeamAllowance() && !piece->IsSeamAllowanceBuiltIn();
bool builtInSeamAllowance = piece->IsSeamAllowance() && piece->IsSeamAllowanceBuiltIn();
bool const seamAllowance = piece->IsSeamAllowance() && !piece->IsSeamAllowanceBuiltIn();
bool const builtInSeamAllowance = piece->IsSeamAllowance() && piece->IsSeamAllowanceBuiltIn();
VBoundary boundary(cuttingLinepoints, seamAllowance, builtInSeamAllowance);
boundary.SetPieceName(piece->GetName());
@ -1066,13 +1066,13 @@ void VPGraphicsPiece::PaintFoldLine(QPainter *painter, const VPPiecePtr &piece)
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::GroupMove(const QPointF &pos)
{
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -1082,7 +1082,7 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
{
QList<VPPiecePtr> pieces;
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
return sheet->GetSelectedPieces();
@ -1091,8 +1091,8 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
return pieces;
};
QList<VPPiecePtr> pieces = PreparePieces();
QPointF newPos = pos - m_moveStartPoint;
QList<VPPiecePtr> const pieces = PreparePieces();
QPointF const newPos = pos - m_moveStartPoint;
if (qFuzzyIsNull(newPos.x()) && qFuzzyIsNull(newPos.y()))
{
@ -1134,13 +1134,13 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPiece::PieceColor() const -> QColor
{
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (piece.isNull())
{
return VSceneStylesheet::ManualLayoutStyle().PieceOkColor();
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return VSceneStylesheet::ManualLayoutStyle().PieceOkColor();
@ -1175,7 +1175,7 @@ auto VPGraphicsPiece::NoBrush() const -> QBrush
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece)
{
VPPiecePtr p = m_piece.toStrongRef();
VPPiecePtr const p = m_piece.toStrongRef();
if (p.isNull())
{
return;
@ -1199,7 +1199,7 @@ void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece)
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::PieceZValueChanged(const VPPiecePtr &piece)
{
VPPiecePtr p = m_piece.toStrongRef();
VPPiecePtr const p = m_piece.toStrongRef();
if (p.isNull() || piece.isNull())
{
return;
@ -1218,12 +1218,12 @@ auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &valu
{
if (change == ItemSelectedHasChanged)
{
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (not piece.isNull())
{
piece->SetSelected(value.toBool());
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(piece);

View File

@ -58,7 +58,7 @@ const qreal centerRadius2 = 10;
auto TransformationOrigin(const VPLayoutPtr &layout, const QRectF &boundingRect) -> VPTransformationOrigon
{
SCASSERT(layout != nullptr)
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
return sheet->TransformationOrigin();
@ -133,7 +133,7 @@ void VPGraphicsTransformationOrigin::paint(QPainter *painter, const QStyleOption
const qreal scale = SceneScale(scene());
QPen pen(CurrentColor(), penWidth / scale, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen const pen(CurrentColor(), penWidth / scale, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter->setPen(pen);
@ -170,10 +170,10 @@ void VPGraphicsTransformationOrigin::mousePressEvent(QGraphicsSceneMouseEvent *e
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsTransformationOrigin::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
VPTransformationOrigon origin = sheet->TransformationOrigin();
@ -225,7 +225,7 @@ auto VPGraphicsTransformationOrigin::RotationCenter(QPainter *painter) const ->
const qreal scale = SceneScale(scene());
qreal radius = centerRadius1 / scale;
VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF());
VPTransformationOrigon const transformationOrigin = TransformationOrigin(m_layout, QRectF());
QRectF rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2.,
radius * 2.);
@ -264,9 +264,9 @@ auto VPGraphicsTransformationOrigin::RotationCenter(QPainter *painter) const ->
auto VPGraphicsTransformationOrigin::Center1() const -> QPainterPath
{
const qreal scale = SceneScale(scene());
qreal radius = centerRadius1 / scale;
VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF());
QRectF rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2.,
qreal const radius = centerRadius1 / scale;
VPTransformationOrigon const transformationOrigin = TransformationOrigin(m_layout, QRectF());
QRectF const rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2.,
radius * 2.);
QPainterPath center1;
@ -279,9 +279,9 @@ auto VPGraphicsTransformationOrigin::Center1() const -> QPainterPath
auto VPGraphicsTransformationOrigin::Center2() const -> QPainterPath
{
const qreal scale = SceneScale(scene());
qreal radius = centerRadius2 / scale;
VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF());
QRectF rect = QRectF(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius,
qreal const radius = centerRadius2 / scale;
VPTransformationOrigon const transformationOrigin = TransformationOrigin(m_layout, QRectF());
QRectF const rect = QRectF(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius,
radius * 2., radius * 2.);
QPainterPath center2;
@ -326,10 +326,10 @@ void VPGraphicsPieceControls::on_UpdateControls()
if (not m_pieceRect.isNull())
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
VPTransformationOrigon origin = sheet->TransformationOrigin();
@ -361,7 +361,7 @@ auto VPGraphicsPieceControls::boundingRect() const -> QRectF
auto HandlerBoundingRect = [this, &boundingRect](VPHandleCorner corner, VPHandleCornerType type, QPointF pos)
{
QPixmap handler = HandlerPixmap(m_handleCorner == corner, type);
QPixmap const handler = HandlerPixmap(m_handleCorner == corner, type);
boundingRect = boundingRect.united(QRectF(pos, handler.size() / handler.devicePixelRatio()));
};
@ -439,12 +439,12 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
PrepareTransformationOrigin(event->modifiers() & Qt::ShiftModifier);
QPointF rotationNewPoint = event->scenePos();
QPointF const rotationNewPoint = event->scenePos();
// get the angle from the center to the initial click point
VPTransformationOrigon rotationOrigin = TransformationOrigin(m_layout, m_pieceRect);
QLineF initPosition(rotationOrigin.origin, m_rotationStartPoint);
QLineF initRotationPosition(rotationOrigin.origin, rotationNewPoint);
VPTransformationOrigon const rotationOrigin = TransformationOrigin(m_layout, m_pieceRect);
QLineF const initPosition(rotationOrigin.origin, m_rotationStartPoint);
QLineF const initRotationPosition(rotationOrigin.origin, rotationNewPoint);
qreal rotateOn = initPosition.angleTo(initRotationPosition);
@ -455,9 +455,9 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (not qFuzzyIsNull(rotateOn))
{
QList<VPPiecePtr> pieces = SelectedPieces();
QList<VPPiecePtr> const pieces = SelectedPieces();
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
CorrectRotationSum(layout, rotationOrigin, rotateOn);
@ -512,10 +512,10 @@ void VPGraphicsPieceControls::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (m_originSaved)
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
if (not m_savedOrigin.custom)
@ -569,7 +569,7 @@ void VPGraphicsPieceControls::InitPixmaps()
const QString resource = QStringLiteral("icon");
const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName);
QPixmap handlePixmap = VTheme::GetPixmapResource(resource, fileName);
QPixmap const handlePixmap = VTheme::GetPixmapResource(resource, fileName);
if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2)
{
@ -608,27 +608,27 @@ auto VPGraphicsPieceControls::TopLeftHandlerPosition() const -> QPointF
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::TopRightHandlerPosition() const -> QPointF
{
QRectF rect = ControllersRect();
QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::TopRight);
QSize size = handler.size() / handler.devicePixelRatio();
QRectF const rect = ControllersRect();
QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::TopRight);
QSize const size = handler.size() / handler.devicePixelRatio();
return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y()};
}
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::BottomRightHandlerPosition() const -> QPointF
{
QRectF rect = ControllersRect();
QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::BottomRight);
QSize size = handler.size() / handler.devicePixelRatio();
QRectF const rect = ControllersRect();
QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::BottomRight);
QSize const size = handler.size() / handler.devicePixelRatio();
return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y() + (rect.height() - size.height())};
}
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::BottomLeftHandlerPosition() const -> QPointF
{
QRectF rect = ControllersRect();
QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::BottomLeft);
QSize size = handler.size() / handler.devicePixelRatio();
QRectF const rect = ControllersRect();
QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::BottomLeft);
QSize const size = handler.size() / handler.devicePixelRatio();
return {rect.topLeft().x(), rect.topLeft().y() + (rect.height() - size.height())};
}
@ -692,7 +692,7 @@ auto VPGraphicsPieceControls::Handles() const -> QPainterPath
auto VPGraphicsPieceControls::ControllersRect() const -> QRectF
{
const qreal scale = SceneScale(scene());
QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::TopLeft);
QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::TopLeft);
QRectF pieceRect = m_pieceRect;
pieceRect = QRectF(pieceRect.topLeft() * scale, QSizeF(pieceRect.width() * scale, pieceRect.height() * scale));
@ -700,13 +700,13 @@ auto VPGraphicsPieceControls::ControllersRect() const -> QRectF
if (pieceRect.width() < handler.width())
{
qreal diff = handler.width() - pieceRect.width();
qreal const diff = handler.width() - pieceRect.width();
rect.adjust(0, 0, diff, 0);
}
if (pieceRect.height() < handler.height())
{
qreal diff = handler.height() - pieceRect.height();
qreal const diff = handler.height() - pieceRect.height();
rect.adjust(0, 0, 0, diff);
}
@ -721,10 +721,10 @@ auto VPGraphicsPieceControls::SelectedPieces() const -> QList<VPPiecePtr>
{
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces = sheet->GetSelectedPieces();
@ -755,7 +755,7 @@ auto VPGraphicsPieceControls::ItemView() -> QGraphicsView *
QGraphicsScene *scene = this->scene();
if (scene != nullptr)
{
QList<QGraphicsView *> views = scene->views();
QList<QGraphicsView *> const views = scene->views();
if (not views.isEmpty())
{
return views.at(0);
@ -794,13 +794,13 @@ void VPGraphicsPieceControls::PrepareTransformationOrigin(bool shiftPressed)
return;
}
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -842,13 +842,13 @@ void VPGraphicsPieceControls::PrepareTransformationOrigin(bool shiftPressed)
return;
}
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -894,7 +894,7 @@ void VPGraphicsPieceControls::CorrectRotationSum(const VPLayoutPtr &layout,
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::SelectedHandleCorner(const QPointF &pos) const -> VPHandleCorner
{
QMap<VPHandleCorner, QPainterPath> corners{
QMap<VPHandleCorner, QPainterPath> const corners{
{VPHandleCorner::TopLeft, TopLeftControl()},
{VPHandleCorner::TopRight, TopRightControl()},
{VPHandleCorner::BottomRight, BottomRightControl()},

View File

@ -48,15 +48,15 @@ auto OptimizeFontSizeToFitTextInRect(QPainter *painter, const QRectF &drawRect,
while ((error > goalError) && (iterationNumber < maxIterationNumber))
{
iterationNumber++;
QRect fontBoundRect = painter->fontMetrics().boundingRect(drawRect.toRect(), flags, text);
QRect const fontBoundRect = painter->fontMetrics().boundingRect(drawRect.toRect(), flags, text);
if (fontBoundRect.isNull())
{
font.setPointSizeF(0.00000001);
break;
}
double xFactor = drawRect.width() / fontBoundRect.width();
double yFactor = drawRect.height() / fontBoundRect.height();
double const xFactor = drawRect.width() / fontBoundRect.width();
double const yFactor = drawRect.height() / fontBoundRect.height();
double factor;
if (xFactor < 1 && yFactor < 1)
{
@ -113,10 +113,10 @@ VPGraphicsTileGrid::VPGraphicsTileGrid(const VPLayoutPtr &layout, const QUuid &s
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsTileGrid::boundingRect() const -> QRectF
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull() && layout->LayoutSettings().GetShowTiles())
{
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
VPSheetPtr const sheet = layout->GetSheet(m_sheetUuid);
QMarginsF sheetMargins;
if (not sheet.isNull() && not sheet->IgnoreMargins())
@ -124,13 +124,14 @@ auto VPGraphicsTileGrid::boundingRect() const -> QRectF
sheetMargins = sheet->GetSheetMargins();
}
qreal xScale = layout->LayoutSettings().HorizontalScale();
qreal yScale = layout->LayoutSettings().VerticalScale();
qreal const xScale = layout->LayoutSettings().HorizontalScale();
qreal const yScale = layout->LayoutSettings().VerticalScale();
qreal width = layout->TileFactory()->DrawingAreaWidth() - VPTileFactory::tileStripeWidth;
qreal height = layout->TileFactory()->DrawingAreaHeight() - VPTileFactory::tileStripeWidth;
qreal const width = layout->TileFactory()->DrawingAreaWidth() - VPTileFactory::tileStripeWidth;
qreal const height = layout->TileFactory()->DrawingAreaHeight() - VPTileFactory::tileStripeWidth;
QRectF rect(sheetMargins.left(), sheetMargins.top(), layout->TileFactory()->ColNb(sheet) * (width / xScale),
QRectF const rect(sheetMargins.left(), sheetMargins.top(),
layout->TileFactory()->ColNb(sheet) * (width / xScale),
layout->TileFactory()->RowNb(sheet) * (height / yScale));
constexpr qreal halfPenWidth = penWidth / 2.;

View File

@ -105,10 +105,10 @@ VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *paren
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RefreshLayout()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SceneData()->RefreshLayout();
@ -119,10 +119,10 @@ void VPMainGraphicsView::RefreshLayout()
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RefreshPieces()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SceneData()->RefreshPieces();
@ -137,7 +137,7 @@ void VPMainGraphicsView::dragEnterEvent(QDragEnterEvent *event)
if (mime->hasFormat(VPMimeDataPiece::mineFormatPiecePtr))
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -159,7 +159,7 @@ void VPMainGraphicsView::dragMoveEvent(QDragMoveEvent *event)
if (mime->hasFormat(VPMimeDataPiece::mineFormatPiecePtr))
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -188,7 +188,7 @@ void VPMainGraphicsView::dropEvent(QDropEvent *event)
if (mime->hasFormat(VPMimeDataPiece::mineFormatPiecePtr))
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -201,7 +201,7 @@ void VPMainGraphicsView::dropEvent(QDropEvent *event)
return;
}
VPPiecePtr piece = mimePiece->GetPiecePtr();
VPPiecePtr const piece = mimePiece->GetPiecePtr();
if (not piece.isNull())
{
qCDebug(pMainGraphicsView(), "element dropped, %s", qUtf8Printable(piece->GetName()));
@ -308,13 +308,13 @@ void VPMainGraphicsView::keyReleaseEvent(QKeyEvent *event)
{
if (not event->isAutoRepeat())
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SceneData()->RotationControls()->SetIgnorePieceTransformation(false);
@ -338,13 +338,13 @@ void VPMainGraphicsView::contextMenuEvent(QContextMenuEvent *event)
return;
}
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
QMenu menu;
@ -369,13 +369,13 @@ void VPMainGraphicsView::contextMenuEvent(QContextMenuEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RestoreOrigin() const
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
VPTransformationOrigon origin = sheet->TransformationOrigin();
@ -384,7 +384,7 @@ void VPMainGraphicsView::RestoreOrigin() const
origin.custom = false;
QRectF boundingRect;
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
QList<VPPiecePtr> const selectedPieces = sheet->GetSelectedPieces();
for (const auto &piece : selectedPieces)
{
if (piece->IsSelected())
@ -409,13 +409,13 @@ void VPMainGraphicsView::on_SceneMouseMove(const QPointF &scenePos)
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -424,15 +424,15 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
sheet->SceneData()->RotationControls()->on_HideHandles(true);
sheet->SceneData()->RotationControls()->SetIgnorePieceTransformation(true);
VPTransformationOrigon origin = sheet->TransformationOrigin();
VPTransformationOrigon const origin = sheet->TransformationOrigin();
auto PreparePieces = [this]()
{
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces = sheet->GetSelectedPieces();
@ -458,7 +458,7 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
m_rotationSum = angle;
}
QList<VPPiecePtr> pieces = PreparePieces();
QList<VPPiecePtr> const pieces = PreparePieces();
if (pieces.size() == 1)
{
@ -477,13 +477,13 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -496,7 +496,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
return;
}
VPPiecePtr piece = graphicsPieces.constFirst()->GetPiece();
VPPiecePtr const piece = graphicsPieces.constFirst()->GetPiece();
if (piece.isNull())
{
return;
@ -505,10 +505,10 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
auto PreparePieces = [this]()
{
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces = sheet->GetSelectedPieces();
@ -518,7 +518,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
return pieces;
};
QList<VPPiecePtr> pieces = PreparePieces();
QList<VPPiecePtr> const pieces = PreparePieces();
if (pieces.size() == 1)
{
const VPPiecePtr &p = pieces.constFirst();
@ -562,7 +562,7 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet)
{
if (not sheet.isNull())
{
QSharedPointer<VMainGraphicsScene> scene = sheet->SceneData()->Scene();
QSharedPointer<VMainGraphicsScene> const scene = sheet->SceneData()->Scene();
setScene(scene.data());
connect(scene.data(), &VMainGraphicsScene::mouseMove, this, &VPMainGraphicsView::on_SceneMouseMove,
Qt::UniqueConnection);
@ -572,19 +572,19 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet)
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::ClearSelection()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
}
QList<VPPiecePtr> pieces = sheet->GetSelectedPieces();
QList<VPPiecePtr> const pieces = sheet->GetSelectedPieces();
for (const auto &piece : pieces)
{
piece->SetSelected(false);
@ -595,25 +595,25 @@ void VPMainGraphicsView::ClearSelection()
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::ZValueMove(int move)
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
}
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
QList<VPPiecePtr> const selectedPieces = sheet->GetSelectedPieces();
if (selectedPieces.isEmpty())
{
return;
}
QList<VPPiecePtr> allPieces = sheet->GetPieces();
QList<VPPiecePtr> const allPieces = sheet->GetPieces();
if (allPieces.isEmpty() || (allPieces.size() == selectedPieces.size()))
{
return;
@ -634,13 +634,13 @@ void VPMainGraphicsView::ZValueMove(int move)
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RemovePiece() const
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -649,13 +649,13 @@ void VPMainGraphicsView::RemovePiece() const
const QList<VPGraphicsPiece *> &graphicsPieces = sheet->SceneData()->GraphicsPieces();
for (auto *graphicsPiece : graphicsPieces)
{
VPPiecePtr piece = graphicsPiece->GetPiece();
VPPiecePtr const piece = graphicsPiece->GetPiece();
if (not piece.isNull() && piece->IsSelected())
{
piece->SetSelected(false);
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(piece);
@ -672,13 +672,13 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
{
if (not event->isAutoRepeat())
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -692,7 +692,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
auto PreparePieces = [layout]()
{
QList<VPPiecePtr> pieces;
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces = sheet->GetSelectedPieces();
@ -701,7 +701,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
return pieces;
};
QList<VPPiecePtr> pieces = PreparePieces();
QList<VPPiecePtr> const pieces = PreparePieces();
if (pieces.size() == 1)
{
const VPPiecePtr &p = pieces.constFirst();
@ -726,13 +726,13 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::on_PieceSheetChanged(const VPPiecePtr &piece)
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetFocusedSheet();
VPSheetPtr const sheet = layout->GetFocusedSheet();
if (sheet.isNull())
{
return;

View File

@ -43,7 +43,7 @@ VPUndoAddSheet::VPUndoAddSheet(const VPSheetPtr &sheet, QUndoCommand *parent)
//---------------------------------------------------------------------------------------------------------------------
void VPUndoAddSheet::undo()
{
VPSheetPtr sheet = m_sheet.toStrongRef();
VPSheetPtr const sheet = m_sheet.toStrongRef();
if (sheet.isNull())
{
return;
@ -51,7 +51,7 @@ void VPUndoAddSheet::undo()
sheet->SetVisible(false);
VPLayoutPtr layout = sheet->GetLayout();
VPLayoutPtr const layout = sheet->GetLayout();
if (layout.isNull())
{
return;
@ -64,13 +64,13 @@ void VPUndoAddSheet::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoAddSheet::redo()
{
VPSheetPtr sheet = m_sheet.toStrongRef();
VPSheetPtr const sheet = m_sheet.toStrongRef();
if (sheet.isNull())
{
return;
}
VPLayoutPtr layout = sheet->GetLayout();
VPLayoutPtr const layout = sheet->GetLayout();
if (layout.isNull())
{
return;

View File

@ -41,7 +41,7 @@ VPUndoMovePieceOnSheet::VPUndoMovePieceOnSheet(const VPSheetPtr &sheet, const VP
m_oldSheet = piece->Sheet();
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (not layout.isNull())
{
m_followGrainline = layout->LayoutSettings().GetFollowGrainline();
@ -53,7 +53,7 @@ VPUndoMovePieceOnSheet::VPUndoMovePieceOnSheet(const VPSheetPtr &sheet, const VP
//---------------------------------------------------------------------------------------------------------------------
void VPUndoMovePieceOnSheet::undo()
{
VPSheetPtr sourceSheet = m_oldSheet.toStrongRef();
VPSheetPtr const sourceSheet = m_oldSheet.toStrongRef();
VPSheetPtr activateSheet = sourceSheet;
if (activateSheet.isNull())
{
@ -71,7 +71,7 @@ void VPUndoMovePieceOnSheet::undo()
}
}
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (not piece.isNull())
{
piece->SetSheet(sourceSheet);
@ -88,7 +88,7 @@ void VPUndoMovePieceOnSheet::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoMovePieceOnSheet::redo()
{
VPSheetPtr sourceSheet = m_sheet.toStrongRef();
VPSheetPtr const sourceSheet = m_sheet.toStrongRef();
VPSheetPtr activateSheet = sourceSheet;
if (activateSheet.isNull())
{
@ -106,7 +106,7 @@ void VPUndoMovePieceOnSheet::redo()
}
}
VPPiecePtr piece = m_piece.toStrongRef();
VPPiecePtr const piece = m_piece.toStrongRef();
if (not piece.isNull())
{
piece->SetSheet(sourceSheet);

View File

@ -47,13 +47,13 @@ VPUndoOriginMove::VPUndoOriginMove(const VPSheetPtr &sheet, const VPTransformati
//---------------------------------------------------------------------------------------------------------------------
void VPUndoOriginMove::undo()
{
VPSheetPtr sheet = m_sheet.toStrongRef();
VPSheetPtr const sheet = m_sheet.toStrongRef();
if (sheet.isNull())
{
return;
}
VPLayoutPtr layout = sheet->GetLayout();
VPLayoutPtr const layout = sheet->GetLayout();
if (layout.isNull())
{
return;
@ -71,13 +71,13 @@ void VPUndoOriginMove::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoOriginMove::redo()
{
VPSheetPtr sheet = m_sheet.toStrongRef();
VPSheetPtr const sheet = m_sheet.toStrongRef();
if (sheet.isNull())
{
return;
}
VPLayoutPtr layout = sheet->GetLayout();
VPLayoutPtr const layout = sheet->GetLayout();
if (layout.isNull())
{
return;
@ -104,13 +104,13 @@ auto VPUndoOriginMove::mergeWith(const QUndoCommand *command) -> bool
const auto *moveCommand = dynamic_cast<const VPUndoOriginMove *>(command);
SCASSERT(moveCommand != nullptr)
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (moveCommand->Sheet().isNull() || sheet.isNull() || not moveCommand->AllowMerge())
{
return false;
}
VPTransformationOrigon origin = moveCommand->Origin();
VPTransformationOrigon const origin = moveCommand->Origin();
if (origin.custom != m_origin.custom)
{

View File

@ -47,13 +47,13 @@ VPUndoPieceMove::VPUndoPieceMove(const VPPiecePtr &piece, qreal dx, qreal dy, bo
//---------------------------------------------------------------------------------------------------------------------
void VPUndoPieceMove::undo()
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -71,13 +71,13 @@ void VPUndoPieceMove::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoPieceMove::redo()
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -104,7 +104,7 @@ auto VPUndoPieceMove::mergeWith(const QUndoCommand *command) -> bool
const auto *moveCommand = dynamic_cast<const VPUndoPieceMove *>(command);
SCASSERT(moveCommand != nullptr)
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (moveCommand->Piece().isNull() || piece.isNull() || moveCommand->Piece() != piece ||
not moveCommand->AllowMerge())
{
@ -150,13 +150,13 @@ void VPUndoPiecesMove::undo()
return;
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
@ -164,7 +164,7 @@ void VPUndoPiecesMove::undo()
for (const auto& piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
if (m_oldTransforms.contains(p->GetUniqueID()))
@ -184,13 +184,13 @@ void VPUndoPiecesMove::redo()
return;
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
@ -198,7 +198,7 @@ void VPUndoPiecesMove::redo()
for (const auto& piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
p->Translate(m_dx, m_dy);
@ -246,7 +246,7 @@ auto VPUndoPiecesMove::Layout() const -> VPLayoutPtr
{
for (const auto& piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
return p->Layout();
@ -261,7 +261,7 @@ auto VPUndoPiecesMove::Sheet() const -> VPSheetPtr
{
for (const auto& piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
return p->Sheet();
@ -277,7 +277,7 @@ inline auto VPUndoPiecesMove::PieceIds() const -> QSet<QString>
QSet<QString> ids;
for (const auto& piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
ids.insert(p->GetUniqueID());

View File

@ -52,7 +52,7 @@ VPUndoPieceRotate::VPUndoPieceRotate(const VPPiecePtr &piece, const VPTransforma
m_oldTransform = piece->GetMatrix();
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (not layout.isNull())
{
m_followGrainline = layout->LayoutSettings().GetFollowGrainline();
@ -64,13 +64,13 @@ VPUndoPieceRotate::VPUndoPieceRotate(const VPPiecePtr &piece, const VPTransforma
//---------------------------------------------------------------------------------------------------------------------
void VPUndoPieceRotate::undo()
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -88,13 +88,13 @@ void VPUndoPieceRotate::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoPieceRotate::redo()
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
@ -147,7 +147,7 @@ auto VPUndoPieceRotate::mergeWith(const QUndoCommand *command) -> bool
const auto *moveCommand = dynamic_cast<const VPUndoPieceRotate *>(command);
SCASSERT(moveCommand != nullptr)
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (not moveCommand->AllowMerge() || (moveCommand->Piece().isNull() || piece.isNull()) ||
moveCommand->Piece() != piece || moveCommand->Origin() != m_origin ||
moveCommand->FollowGrainline() != m_followGrainline)
@ -186,7 +186,7 @@ VPUndoPiecesRotate::VPUndoPiecesRotate(const QList<VPPiecePtr> &pieces, const VP
}
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (not layout.isNull())
{
m_followGrainline = layout->LayoutSettings().GetFollowGrainline();
@ -201,13 +201,13 @@ void VPUndoPiecesRotate::undo()
return;
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
@ -215,7 +215,7 @@ void VPUndoPiecesRotate::undo()
for (const auto &piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
if (m_oldTransforms.contains(p->GetUniqueID()))
@ -235,13 +235,13 @@ void VPUndoPiecesRotate::redo()
return;
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
@ -249,7 +249,7 @@ void VPUndoPiecesRotate::redo()
for (const auto &piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
if (m_firstCall)
@ -319,7 +319,7 @@ auto VPUndoPiecesRotate::PieceIds() const -> QSet<QString>
QSet<QString> ids;
for (const auto &piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
ids.insert(p->GetUniqueID());
@ -334,7 +334,7 @@ auto VPUndoPiecesRotate::Layout() const -> VPLayoutPtr
{
for (const auto &piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
return p->Layout();
@ -349,7 +349,7 @@ auto VPUndoPiecesRotate::Sheet() const -> VPSheetPtr
{
for (const auto &piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
return p->Sheet();

View File

@ -65,7 +65,7 @@ VPUndoPieceZValueMove::VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValue
{
setText(QObject::tr("z value move piece"));
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (not sheet.isNull())
{
const QList<VPPiecePtr> pieces = sheet->GetPieces();
@ -82,19 +82,19 @@ VPUndoPieceZValueMove::VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValue
//---------------------------------------------------------------------------------------------------------------------
void VPUndoPieceZValueMove::undo()
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (sheet.isNull())
{
return;
@ -123,19 +123,19 @@ void VPUndoPieceZValueMove::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoPieceZValueMove::redo()
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return;
}
VPLayoutPtr layout = piece->Layout();
VPLayoutPtr const layout = piece->Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (sheet.isNull())
{
return;
@ -187,7 +187,7 @@ void VPUndoPieceZValueMove::redo()
order.prepend({piece->GetUniqueID()});
}
QHash<QString, qreal> correctedZValues = CorrectedZValues(order);
QHash<QString, qreal> const correctedZValues = CorrectedZValues(order);
for (const auto &p: pieces)
{
if (not p.isNull())
@ -215,7 +215,7 @@ auto VPUndoPieceZValueMove::Piece() const -> VPPiecePtr
//---------------------------------------------------------------------------------------------------------------------
auto VPUndoPieceZValueMove::Sheet() const -> VPSheetPtr
{
VPPiecePtr p = Piece();
VPPiecePtr const p = Piece();
if (not p.isNull())
{
return p->Sheet();
@ -227,7 +227,7 @@ auto VPUndoPieceZValueMove::Sheet() const -> VPSheetPtr
//---------------------------------------------------------------------------------------------------------------------
auto VPUndoPieceZValueMove::Levels(const QList<VPPiecePtr> &pieces, bool skip) const -> QList<QVector<QString> >
{
VPPiecePtr piece = Piece();
VPPiecePtr const piece = Piece();
if (piece.isNull())
{
return {};
@ -260,7 +260,7 @@ auto VPUndoPieceZValueMove::Levels(const QList<VPPiecePtr> &pieces, bool skip) c
//---------------------------------------------------------------------------------------------------------------------
auto VPUndoPieceZValueMove::LevelStep(const QList<VPPiecePtr> &pieces) const -> qreal
{
QList<QVector<QString>> levels = Levels(pieces, false);
QList<QVector<QString>> const levels = Levels(pieces, false);
if (levels.isEmpty())
{
return 0;
@ -284,7 +284,7 @@ VPUndoPiecesZValueMove::VPUndoPiecesZValueMove(const QList<VPPiecePtr> &pieces,
m_pieces.append(p);
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (not sheet.isNull())
{
const QList<VPPiecePtr> pieces = sheet->GetPieces();
@ -306,13 +306,13 @@ void VPUndoPiecesZValueMove::undo()
return;
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (sheet.isNull())
{
return;
@ -346,13 +346,13 @@ void VPUndoPiecesZValueMove::redo()
return;
}
VPLayoutPtr layout = Layout();
VPLayoutPtr const layout = Layout();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = Sheet();
VPSheetPtr const sheet = Sheet();
if (sheet.isNull())
{
return;
@ -364,7 +364,7 @@ void VPUndoPiecesZValueMove::redo()
}
const QList<VPPiecePtr> allPieces = sheet->GetPieces();
QVector<QString> ids = PieceIds();
QVector<QString> const ids = PieceIds();
QList<QVector<QString>> order;
@ -405,7 +405,7 @@ void VPUndoPiecesZValueMove::redo()
order.prepend(ids);
}
QHash<QString, qreal> correctedZValues = CorrectedZValues(order);
QHash<QString, qreal> const correctedZValues = CorrectedZValues(order);
for (const auto &p: allPieces)
{
if (not p.isNull())
@ -429,7 +429,7 @@ auto VPUndoPiecesZValueMove::Layout() const -> VPLayoutPtr
{
for (const auto& piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
return p->Layout();
@ -444,7 +444,7 @@ auto VPUndoPiecesZValueMove::Sheet() const -> VPSheetPtr
{
for (const auto& piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
return p->Sheet();
@ -462,7 +462,7 @@ auto VPUndoPiecesZValueMove::PieceIds() const -> QVector<QString>
for (const auto& piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
ids.append(p->GetUniqueID());
@ -503,7 +503,7 @@ auto VPUndoPiecesZValueMove::Levels(const QList<VPPiecePtr> &allPieces, const QV
//---------------------------------------------------------------------------------------------------------------------
auto VPUndoPiecesZValueMove::LevelStep(const QList<VPPiecePtr> &pieces) -> qreal
{
QList<QVector<QString>> levels = Levels(pieces, QVector<QString>(), false);
QList<QVector<QString>> const levels = Levels(pieces, QVector<QString>(), false);
if (levels.isEmpty())
{
return 0;

View File

@ -38,7 +38,7 @@ VPUndoRemoveSheet::VPUndoRemoveSheet(const VPSheetPtr &sheet, QUndoCommand *pare
{
SCASSERT(not sheet.isNull())
QList<VPPiecePtr> pieces = sheet->GetPieces();
QList<VPPiecePtr> const pieces = sheet->GetPieces();
m_pieces.reserve(pieces.size());
for (const auto &piece : pieces)
{
@ -51,7 +51,7 @@ VPUndoRemoveSheet::VPUndoRemoveSheet(const VPSheetPtr &sheet, QUndoCommand *pare
//---------------------------------------------------------------------------------------------------------------------
void VPUndoRemoveSheet::undo()
{
VPSheetPtr sheet = m_sheet.toStrongRef();
VPSheetPtr const sheet = m_sheet.toStrongRef();
if (sheet.isNull())
{
return;
@ -63,14 +63,14 @@ void VPUndoRemoveSheet::undo()
for (const auto &piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
p->SetSheet(sheet);
}
}
VPLayoutPtr layout = sheet->GetLayout();
VPLayoutPtr const layout = sheet->GetLayout();
if (layout.isNull())
{
return;
@ -84,7 +84,7 @@ void VPUndoRemoveSheet::undo()
//---------------------------------------------------------------------------------------------------------------------
void VPUndoRemoveSheet::redo()
{
VPSheetPtr sheet = m_sheet.toStrongRef();
VPSheetPtr const sheet = m_sheet.toStrongRef();
if (sheet.isNull())
{
return;
@ -96,7 +96,7 @@ void VPUndoRemoveSheet::redo()
for (const auto &piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
VPPiecePtr const p = piece.toStrongRef();
if (not p.isNull())
{
p->SetSheet(VPSheetPtr());
@ -104,7 +104,7 @@ void VPUndoRemoveSheet::redo()
}
}
VPLayoutPtr layout = sheet->GetLayout();
VPLayoutPtr const layout = sheet->GetLayout();
if (layout.isNull())
{
return;

View File

@ -269,7 +269,7 @@ VPApplication::~VPApplication()
{
auto *statistic = VGAnalytics::Instance();
QString clientID = settings->GetClientID();
QString const clientID = settings->GetClientID();
if (!clientID.isEmpty())
{
statistic->SendAppCloseEvent(m_uptimeTimer.elapsed());
@ -422,7 +422,7 @@ void VPApplication::InitOptions()
QTimer::singleShot(0, this,
[]()
{
QString country = VGAnalytics::CountryCode();
QString const country = VGAnalytics::CountryCode();
if (country == "ru"_L1 || country == "by"_L1)
{
qFatal("country not detected");
@ -506,7 +506,7 @@ void VPApplication::ProcessArguments(const VPCommandLinePtr &cmd)
{
const QStringList rawLayouts = cmd->OptionRawLayouts();
const QStringList args = cmd->OptionFileNames();
bool success = args.count() > 0 ? StartWithFiles(cmd, rawLayouts) : SingleStart(cmd, rawLayouts);
bool const success = args.count() > 0 ? StartWithFiles(cmd, rawLayouts) : SingleStart(cmd, rawLayouts);
if (not success)
{
@ -596,7 +596,7 @@ void VPApplication::AboutToQuit()
//---------------------------------------------------------------------------------------------------------------------
void VPApplication::NewLocalSocketConnection()
{
QScopedPointer<QLocalSocket> socket(m_localServer->nextPendingConnection());
QScopedPointer<QLocalSocket> const socket(m_localServer->nextPendingConnection());
if (socket.isNull())
{
return;

View File

@ -112,7 +112,7 @@ void RemoveLayoutPath(const QString &path, bool usedNotExistedDir)
{
if (usedNotExistedDir)
{
QDir dir(path);
QDir const dir(path);
dir.rmpath(QChar('.'));
}
}
@ -198,13 +198,13 @@ void SetPrinterSheetPageSettings(const QSharedPointer<QPrinter> &printer, const
margins = sheet->GetSheetMargins();
}
QPageLayout::Orientation sheetOrientation = sheet->GetSheetOrientation();
QPageLayout::Orientation const sheetOrientation = sheet->GetSheetOrientation();
QRectF imageRect = sheet->GetMarginsRect();
qreal width = FromPixel(imageRect.width() * xScale + margins.left() + margins.right(), Unit::Mm);
qreal height = FromPixel(imageRect.height() * yScale + margins.top() + margins.bottom(), Unit::Mm);
QRectF const imageRect = sheet->GetMarginsRect();
qreal const width = FromPixel(imageRect.width() * xScale + margins.left() + margins.right(), Unit::Mm);
qreal const height = FromPixel(imageRect.height() * yScale + margins.top() + margins.bottom(), Unit::Mm);
QSizeF pageSize = sheetOrientation == QPageLayout::Portrait ? QSizeF(width, height) : QSizeF(height, width);
QSizeF const pageSize = sheetOrientation == QPageLayout::Portrait ? QSizeF(width, height) : QSizeF(height, width);
if (not printer->setPageSize(QPageSize(pageSize, QPageSize::Millimeter)))
{
qWarning() << QObject::tr("Cannot set printer page size");
@ -280,14 +280,14 @@ auto IsValidFileName(const QString &fileName) -> bool
return false;
}
static QRegularExpression regex(QStringLiteral("[<>:\"/\\\\|?*]"));
static QRegularExpression const regex(QStringLiteral("[<>:\"/\\\\|?*]"));
QRegularExpressionMatch match = regex.match(fileName);
if (match.hasMatch())
{
return false;
}
static QRegularExpression regexReservedNames(QStringLiteral("^(CON|AUX|PRN|NUL|COM[1-9]|LPT[1-9])(\\..*)?$"),
static QRegularExpression const regexReservedNames(QStringLiteral("^(CON|AUX|PRN|NUL|COM[1-9]|LPT[1-9])(\\..*)?$"),
QRegularExpression::CaseInsensitiveOption);
match = regexReservedNames.match(fileName);
if (match.hasMatch())
@ -398,7 +398,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
connect(m_layoutWatcher, &QFileSystemWatcher::fileChanged, this,
[this](const QString &path)
{
QFileInfo checkFile(path);
QFileInfo const checkFile(path);
if (not checkFile.exists())
{
for (int i = 0; i <= 1000; i = i + 10)
@ -770,7 +770,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this,
[this](bool checked)
{
QList<VPPiecePtr> selectedPieces = SelectedPieces();
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
@ -787,7 +787,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
connect(ui->checkBoxShowFullPiece, &QCheckBox::toggled, this,
[this](bool checked)
{
QList<VPPiecePtr> selectedPieces = SelectedPieces();
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
@ -806,7 +806,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
connect(ui->checkBoxCurrentPieceVerticallyFlipped, &QCheckBox::toggled, this,
[this](bool checked)
{
QList<VPPiecePtr> selectedPieces = SelectedPieces();
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
@ -825,7 +825,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
connect(ui->checkBoxCurrentPieceHorizontallyFlipped, &QCheckBox::toggled, this,
[this](bool checked)
{
QList<VPPiecePtr> selectedPieces = SelectedPieces();
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
@ -914,7 +914,7 @@ void VPMainWindow::InitPropertyTabCurrentSheet()
{
if (not m_layout.isNull())
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SetName(text);
@ -982,7 +982,7 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix)
connect(ui->toolButtonGrainlineHorizontalOrientation, &QToolButton::clicked, this,
[this](bool checked)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -1005,7 +1005,7 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix)
connect(ui->toolButtonGrainlineVerticalOrientation, &QToolButton::clicked, this,
[this](bool checked)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -1030,7 +1030,7 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix)
{
if (not m_layout.isNull())
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->RemoveUnusedLength();
@ -1071,7 +1071,7 @@ void VPMainWindow::InitMarginsData(const QString &suffix)
ui->doubleSpinBoxSheetMarginTop->setDisabled(state != 0);
ui->doubleSpinBoxSheetMarginBottom->setDisabled(state != 0);
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SetIgnoreMargins(state != 0);
@ -1373,7 +1373,7 @@ void VPMainWindow::SetPropertyTabSheetData()
{
if (not m_layout.isNull())
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
ui->groupBoxSheetInfos->setDisabled(false);
@ -1403,7 +1403,7 @@ void VPMainWindow::SetPropertyTabSheetData()
ui->doubleSpinBoxSheetMarginBottom->setSuffix(suffix);
// set Width / Length
QSizeF size = sheet->GetSheetSizeConverted();
QSizeF const size = sheet->GetSheetSizeConverted();
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperWidth, size.width());
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperHeight, size.height());
@ -1412,7 +1412,7 @@ void VPMainWindow::SetPropertyTabSheetData()
// set margins
ui->groupBoxSheetMargin->setDisabled(false);
QMarginsF margins = sheet->GetSheetMarginsConverted();
QMarginsF const margins = sheet->GetSheetMarginsConverted();
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginLeft, margins.left());
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginTop, margins.top());
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginRight, margins.right());
@ -1428,7 +1428,7 @@ void VPMainWindow::SetPropertyTabSheetData()
ui->doubleSpinBoxSheetMarginTop->setDisabled(ignoreMargins);
ui->doubleSpinBoxSheetMarginBottom->setDisabled(ignoreMargins);
GrainlineType type = sheet->GetGrainlineType();
GrainlineType const type = sheet->GetGrainlineType();
ui->toolButtonGrainlineHorizontalOrientation->setChecked(type == GrainlineType::Horizontal);
ui->toolButtonGrainlineVerticalOrientation->setChecked(type == GrainlineType::Vertical);
@ -1489,7 +1489,7 @@ void VPMainWindow::SetPropertyTabTilesData()
{
ui->groupBoxTilePaperFormat->setDisabled(false);
// set Width / Length
QSizeF size = m_layout->LayoutSettings().GetTilesSizeConverted();
QSizeF const size = m_layout->LayoutSettings().GetTilesSizeConverted();
SetDoubleSpinBoxValue(ui->doubleSpinBoxTilePaperWidth, size.width());
SetDoubleSpinBoxValue(ui->doubleSpinBoxTilePaperHeight, size.height());
@ -1498,7 +1498,7 @@ void VPMainWindow::SetPropertyTabTilesData()
// set margins
ui->groupBoxTileMargins->setDisabled(false);
QMarginsF margins = m_layout->LayoutSettings().GetTilesMarginsConverted();
QMarginsF const margins = m_layout->LayoutSettings().GetTilesMarginsConverted();
SetDoubleSpinBoxValue(ui->doubleSpinBoxTileMarginLeft, margins.left());
SetDoubleSpinBoxValue(ui->doubleSpinBoxTileMarginTop, margins.top());
SetDoubleSpinBoxValue(ui->doubleSpinBoxTileMarginRight, margins.right());
@ -1692,7 +1692,7 @@ void VPMainWindow::UpdateWindowTitle()
}
else
{
vsizetype index = VPApplication::VApp()->MainWindows().indexOf(this);
vsizetype const index = VPApplication::VApp()->MainWindows().indexOf(this);
if (index != -1)
{
showName = tr("untitled %1.vlt").arg(index + 1);
@ -1794,7 +1794,7 @@ auto VPMainWindow::MaybeSave() -> bool
// TODO: Implement maybe save check
if (this->isWindowModified())
{
QScopedPointer<QMessageBox> messageBox(
QScopedPointer<QMessageBox> const messageBox(
new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"),
tr("Layout has been modified. Do you want to save your changes?"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet));
@ -1876,7 +1876,7 @@ auto VPMainWindow::IsLayoutReadOnly() const -> bool
return false;
}
QFileInfo f(curFile);
QFileInfo const f(curFile);
if (not f.exists())
{
@ -1887,7 +1887,7 @@ auto VPMainWindow::IsLayoutReadOnly() const -> bool
// qt_ntfs_permission_lookup++; // turn checking on
// #endif /*Q_OS_WIN32*/
bool fileWritable = f.isWritable();
bool const fileWritable = f.isWritable();
// #ifdef Q_OS_WIN32
// qt_ntfs_permission_lookup--; // turn it off again
@ -1918,7 +1918,7 @@ auto VPMainWindow::SelectedPieces() const -> QList<VPPiecePtr>
QList<VPPiecePtr> selectedPieces;
if (not m_layout.isNull())
{
VPSheetPtr activeSheet = m_layout->GetFocusedSheet();
VPSheetPtr const activeSheet = m_layout->GetFocusedSheet();
if (not activeSheet.isNull())
{
selectedPieces = activeSheet->GetSelectedPieces();
@ -2070,7 +2070,7 @@ void VPMainWindow::CorrectPaperDecimals()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::SheetPaperSizeChanged()
{
bool portrait = ui->doubleSpinBoxSheetPaperHeight->value() >= ui->doubleSpinBoxSheetPaperWidth->value();
bool const portrait = ui->doubleSpinBoxSheetPaperHeight->value() >= ui->doubleSpinBoxSheetPaperWidth->value();
ui->toolButtonSheetPortraitOritation->blockSignals(true);
ui->toolButtonSheetPortraitOritation->setChecked(portrait);
@ -2087,7 +2087,7 @@ void VPMainWindow::SheetPaperSizeChanged()
RotatePiecesToGrainline();
}
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->ValidatePiecesOutOfBound();
@ -2103,7 +2103,7 @@ void VPMainWindow::SheetPaperSizeChanged()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::TilePaperSizeChanged()
{
bool portrait = ui->doubleSpinBoxTilePaperHeight->value() >= ui->doubleSpinBoxTilePaperWidth->value();
bool const portrait = ui->doubleSpinBoxTilePaperHeight->value() >= ui->doubleSpinBoxTilePaperWidth->value();
ui->toolButtonTilePortraitOrientation->blockSignals(true);
ui->toolButtonTilePortraitOrientation->setChecked(portrait);
@ -2228,12 +2228,12 @@ void VPMainWindow::RotatePiecesToGrainline()
return;
}
QList<VPSheetPtr> sheets = m_layout->GetAllSheets();
QList<VPSheetPtr> const sheets = m_layout->GetAllSheets();
for (const auto &sheet : sheets)
{
if (not sheet.isNull())
{
QList<VPPiecePtr> pieces = sheet->GetPieces();
QList<VPPiecePtr> const pieces = sheet->GetPieces();
for (const auto &piece : pieces)
{
if (not piece.isNull() && piece->IsGrainlineEnabled())
@ -2275,7 +2275,7 @@ void VPMainWindow::ExportData(const VPExportData &data)
name = data.path + '/' + data.fileName + VLayoutExporter::ExportFormatSuffix(data.format);
}
VPSheetPtr sheet = data.sheets.at(i);
VPSheetPtr const sheet = data.sheets.at(i);
ExportApparelLayout(data, sheet->GetAsLayoutPieces(), name, sheet->GetSheetSize().toSize());
}
}
@ -2290,7 +2290,7 @@ void VPMainWindow::ExportApparelLayout(const VPExportData &data, const QVector<V
const QString &name, const QSize &size)
{
const QString path = data.path;
bool usedNotExistedDir = CreateLayoutPath(path);
bool const usedNotExistedDir = CreateLayoutPath(path);
if (not usedNotExistedDir)
{
qCritical() << tr("Can't create a path");
@ -2351,7 +2351,7 @@ void VPMainWindow::ExportApparelLayout(const VPExportData &data, const QVector<V
void VPMainWindow::ExportFlatLayout(const VPExportData &data)
{
const QString path = data.path;
bool usedNotExistedDir = CreateLayoutPath(path);
bool const usedNotExistedDir = CreateLayoutPath(path);
if (not usedNotExistedDir)
{
qCritical() << tr("Can't create a path");
@ -2396,7 +2396,7 @@ void VPMainWindow::ExportScene(const VPExportData &data)
exporter.SetBinaryDxfFormat(data.isBinaryDXF);
exporter.SetShowGrainline(data.showGrainline);
QList<VPSheetPtr> sheets = data.sheets;
QList<VPSheetPtr> const sheets = data.sheets;
for (int i = 0; i < sheets.size(); ++i)
{
@ -2549,7 +2549,7 @@ void VPMainWindow::ExportUnifiedPdfFile(const VPExportData &data)
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QString &name)
{
QSharedPointer<QPrinter> printer(new QPrinter());
QSharedPointer<QPrinter> const printer(new QPrinter());
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
printer->setOutputFormat(QPrinter::PdfFormat);
@ -2595,7 +2595,7 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin
sheet->SceneData()->PrepareForExport(); // Go first because recreates pieces
VLayoutExporter::PrepareGrainlineForExport(sheet->SceneData()->GraphicsPiecesAsItems(), data.showGrainline);
QRectF imageRect = sheet->GetMarginsRect();
QRectF const imageRect = sheet->GetMarginsRect();
sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer.data(), imageRect),
imageRect, Qt::IgnoreAspectRatio);
sheet->SceneData()->CleanAfterExport(); // Will restore the grainlines automatically
@ -2609,7 +2609,7 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
{
QSharedPointer<QPrinter> printer(new QPrinter());
QSharedPointer<QPrinter> const printer(new QPrinter());
#ifdef Q_OS_MAC
printer->setOutputFormat(QPrinter::NativeFormat);
#else
@ -2901,7 +2901,7 @@ auto VPMainWindow::AskLayoutIsInvalid(const QList<VPSheetPtr> &sheets) -> bool
bool outOfBoundChecked = false;
bool pieceSuperpositionChecked = false;
QList<VPPiecePtr> pieces = sheet->GetPieces();
QList<VPPiecePtr> const pieces = sheet->GetPieces();
for (const auto &piece : pieces)
{
if (not CheckPiecesOutOfBound(piece, outOfBoundChecked))
@ -3026,7 +3026,7 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
{
for (int j = 0; j < numPages; ++j)
{
vsizetype index =
vsizetype const index =
printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
const VPSheetPtr &sheet = sheets.at(index);
@ -3053,7 +3053,7 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co
if (not sheet->IgnoreMargins())
{
QMarginsF margins = sheet->GetSheetMargins();
QMarginsF const margins = sheet->GetSheetMargins();
if (not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter))
{
qWarning() << QObject::tr("Cannot set printer margins");
@ -3067,7 +3067,7 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co
}
sheet->SceneData()->PrepareForExport();
QRectF imageRect = sheet->GetMarginsRect();
QRectF const imageRect = sheet->GetMarginsRect();
sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer, imageRect), imageRect,
Qt::IgnoreAspectRatio);
sheet->SceneData()->CleanAfterExport();
@ -3116,7 +3116,7 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheet
{
for (int j = 0; j < numPages; ++j)
{
vsizetype index =
vsizetype const index =
printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
const VPLayoutPrinterPage &page = pages.at(index);
@ -3232,19 +3232,19 @@ auto VPMainWindow::PrintLayoutTiledSheetPage(QPrinter *printer, QPainter &painte
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::ZValueMove(int move)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
}
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
QList<VPPiecePtr> const selectedPieces = sheet->GetSelectedPieces();
if (selectedPieces.isEmpty())
{
return;
}
QList<VPPiecePtr> allPieces = sheet->GetPieces();
QList<VPPiecePtr> const allPieces = sheet->GetPieces();
if (allPieces.isEmpty() || (allPieces.size() == selectedPieces.size()))
{
return;
@ -3291,7 +3291,7 @@ auto VPMainWindow::AddLayoutPieces(const QVector<VLayoutPiece> &pieces) -> bool
{
for (quint16 i = 1; i <= rawPiece.GetQuantity(); ++i)
{
VPPiecePtr piece(new VPPiece(rawPiece));
VPPiecePtr const piece(new VPPiece(rawPiece));
piece->SetCopyNumber(i);
QString error;
@ -3339,7 +3339,7 @@ void VPMainWindow::TranslatePieces()
m_layout->UndoStack()->beginMacro(tr("translate pieces"));
}
QRectF rect = PiecesBoundingRect(selectedPieces);
QRectF const rect = PiecesBoundingRect(selectedPieces);
for (const auto &piece : qAsConst(selectedPieces))
{
TranslatePieceRelatively(piece, rect, selectedPieces.size(), dx, dy);
@ -3358,9 +3358,9 @@ void VPMainWindow::TranslatePieces()
}
else
{
QRectF rect = PiecesBoundingRect(selectedPieces);
qreal pieceDx = dx - rect.topLeft().x();
qreal pieceDy = dy - rect.topLeft().y();
QRectF const rect = PiecesBoundingRect(selectedPieces);
qreal const pieceDx = dx - rect.topLeft().x();
qreal const pieceDy = dy - rect.topLeft().y();
if (selectedPieces.size() == 1)
{
@ -3404,7 +3404,7 @@ void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRect
qreal stickyTranslateY = 0;
if (piece->StickyPosition(stickyTranslateX, stickyTranslateY))
{
bool allowMerge = selectedPiecesCount == 1;
bool const allowMerge = selectedPiecesCount == 1;
auto *stickyCommand = new VPUndoPieceMove(piece, stickyTranslateX, stickyTranslateY, allowMerge);
m_layout->UndoStack()->push(stickyCommand);
}
@ -3422,7 +3422,7 @@ void VPMainWindow::RotatePieces()
angle *= -1;
}
QList<VPPiecePtr> selectedPieces = SelectedPieces();
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.isEmpty())
{
return;
@ -3449,13 +3449,13 @@ void VPMainWindow::RotatePieces()
}
else
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
}
VPTransformationOrigon origin = sheet->TransformationOrigin();
VPTransformationOrigon const origin = sheet->TransformationOrigin();
auto *command = new VPUndoPiecesRotate(selectedPieces, origin, angle, angle);
m_layout->UndoStack()->push(command);
}
@ -3600,9 +3600,9 @@ auto VPMainWindow::on_actionSave_triggered() -> bool
//---------------------------------------------------------------------------------------------------------------------
auto VPMainWindow::on_actionSaveAs_triggered() -> bool
{
QString filters = tr("Layout files") + QStringLiteral(" (*.vlt)");
QString suffix = QStringLiteral("vlt");
QString fName = tr("layout") + '.'_L1 + suffix;
QString const filters = tr("Layout files") + QStringLiteral(" (*.vlt)");
QString const suffix = QStringLiteral("vlt");
QString const fName = tr("layout") + '.'_L1 + suffix;
QString dir;
if (curFile.isEmpty())
@ -3622,7 +3622,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
return false;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += '.'_L1 + suffix;
@ -3641,7 +3641,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
if (QFileInfo::exists(fileName) && curFile != fileName)
{
// Temporary try to lock the file before saving
VLockGuard<char> tmp(fileName);
VLockGuard<char> const tmp(fileName);
if (not tmp.IsLocked())
{
qCCritical(pWindow, "%s",
@ -3651,7 +3651,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
}
QString error;
bool result = SaveLayout(fileName, error);
bool const result = SaveLayout(fileName, error);
if (not result)
{
QMessageBox messageBox;
@ -3720,7 +3720,7 @@ void VPMainWindow::on_actionAboutPuzzle_triggered()
void VPMainWindow::on_LayoutUnitChanged(int index)
{
Q_UNUSED(index);
QVariant comboBoxValue = ui->comboBoxLayoutUnit->currentData();
QVariant const comboBoxValue = ui->comboBoxLayoutUnit->currentData();
m_layout->LayoutSettings().SetUnit(StrToUnits(comboBoxValue.toString()));
SetPropertyTabCurrentPieceData();
@ -3733,7 +3733,7 @@ void VPMainWindow::on_SheetSizeChanged()
{
if (not m_layout.isNull())
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SetSheetSizeConverted(ui->doubleSpinBoxSheetPaperWidth->value(),
@ -3761,7 +3761,7 @@ void VPMainWindow::on_SheetOrientationChanged(bool checked)
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperWidth, height);
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperHeight, width);
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SetSheetSizeConverted(height, width); // NOLINT(readability-suspicious-call-argument)
@ -3780,7 +3780,7 @@ void VPMainWindow::on_SheetMarginChanged()
{
if (not m_layout.isNull())
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->SetSheetMarginsConverted(
@ -3977,7 +3977,7 @@ void VPMainWindow::ToolBarStyles()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionAddSheet_triggered()
{
VPSheetPtr sheet(new VPSheet(m_layout));
VPSheetPtr const sheet(new VPSheet(m_layout));
sheet->SetName(tr("Sheet %1").arg(m_layout->GetAllSheets().size() + 1));
m_layout->UndoStack()->push(new VPUndoAddSheet(sheet));
}
@ -4013,7 +4013,7 @@ void VPMainWindow::on_ResetPieceTransformationSettings()
}
else
{
int unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(UnitsToStr(Unit::Px)));
int const unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(UnitsToStr(Unit::Px)));
if (unitIndex != -1)
{
ui->comboBoxTranslateUnit->setCurrentIndex(unitIndex);
@ -4036,7 +4036,7 @@ void VPMainWindow::on_RelativeTranslationChanged(bool checked)
}
else
{
QRectF rect = PiecesBoundingRect(SelectedPieces());
QRectF const rect = PiecesBoundingRect(SelectedPieces());
ui->doubleSpinBoxCurrentPieceBoxPositionX->setValue(
UnitConvertor(rect.topLeft().x(), Unit::Px, TranslateUnit()));
@ -4096,7 +4096,7 @@ void VPMainWindow::on_ConvertPaperSize()
const qreal newTileTopMargin = UnitConvertor(tileTopMargin, m_oldLayoutUnit, layoutUnit);
const qreal newTileBottomMargin = UnitConvertor(tileBottomMargin, m_oldLayoutUnit, layoutUnit);
qreal newGap = UnitConvertor(ui->doubleSpinBoxSheetPiecesGap->value(), m_oldLayoutUnit, layoutUnit);
qreal const newGap = UnitConvertor(ui->doubleSpinBoxSheetPiecesGap->value(), m_oldLayoutUnit, layoutUnit);
m_oldLayoutUnit = layoutUnit;
m_layout->LayoutSettings().SetUnit(layoutUnit);
@ -4166,7 +4166,7 @@ void VPMainWindow::on_ExportLayout()
return;
}
QList<VPSheetPtr> sheets = m_layout->GetSheets();
QList<VPSheetPtr> const sheets = m_layout->GetSheets();
if (sheets.isEmpty())
{
return;
@ -4216,7 +4216,7 @@ void VPMainWindow::on_ExportSheet()
return;
}
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -4273,7 +4273,7 @@ void VPMainWindow::on_actionPrintLayout_triggered()
return;
}
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4284,15 +4284,15 @@ void VPMainWindow::on_actionPrintLayout_triggered()
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
QList<VPSheetPtr> const sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
qCritical() << tr("Unable to get sheet page settings");
}
qreal xScale = m_layout->LayoutSettings().HorizontalScale();
qreal yScale = m_layout->LayoutSettings().VerticalScale();
qreal const xScale = m_layout->LayoutSettings().HorizontalScale();
qreal const yScale = m_layout->LayoutSettings().VerticalScale();
SetPrinterSheetPageSettings(printer, firstSheet, xScale, yScale);
printer->setDocName(m_layout->LayoutSettings().GetTitle());
@ -4324,7 +4324,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered()
return;
}
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter());
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter());
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4335,7 +4335,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered()
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
QList<VPSheetPtr> const sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
@ -4343,8 +4343,8 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered()
return;
}
qreal xScale = m_layout->LayoutSettings().HorizontalScale();
qreal yScale = m_layout->LayoutSettings().VerticalScale();
qreal const xScale = m_layout->LayoutSettings().HorizontalScale();
qreal const yScale = m_layout->LayoutSettings().VerticalScale();
SetPrinterSheetPageSettings(printer, firstSheet, xScale, yScale);
printer->setDocName(m_layout->LayoutSettings().GetTitle());
@ -4359,7 +4359,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionPrintTiledLayout_triggered()
{
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4370,7 +4370,7 @@ void VPMainWindow::on_actionPrintTiledLayout_triggered()
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
QList<VPSheetPtr> const sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
@ -4397,7 +4397,7 @@ void VPMainWindow::on_actionPrintTiledLayout_triggered()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionPrintPreviewTiledLayout_triggered()
{
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4408,7 +4408,7 @@ void VPMainWindow::on_actionPrintPreviewTiledLayout_triggered()
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
QList<VPSheetPtr> const sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
@ -4441,7 +4441,7 @@ void VPMainWindow::on_printLayoutTiledPages(QPrinter *printer)
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionPrintSheet_triggered()
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -4452,7 +4452,7 @@ void VPMainWindow::on_actionPrintSheet_triggered()
return;
}
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4463,8 +4463,8 @@ void VPMainWindow::on_actionPrintSheet_triggered()
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
qreal xScale = m_layout->LayoutSettings().HorizontalScale();
qreal yScale = m_layout->LayoutSettings().VerticalScale();
qreal const xScale = m_layout->LayoutSettings().HorizontalScale();
qreal const yScale = m_layout->LayoutSettings().VerticalScale();
SetPrinterSheetPageSettings(printer, sheet, xScale, yScale);
printer->setDocName(sheet->GetName());
@ -4485,7 +4485,7 @@ void VPMainWindow::on_actionPrintSheet_triggered()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionPrintPreviewSheet_triggered()
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -4496,7 +4496,7 @@ void VPMainWindow::on_actionPrintPreviewSheet_triggered()
return;
}
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter());
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter());
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4507,8 +4507,8 @@ void VPMainWindow::on_actionPrintPreviewSheet_triggered()
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
qreal xScale = m_layout->LayoutSettings().HorizontalScale();
qreal yScale = m_layout->LayoutSettings().VerticalScale();
qreal const xScale = m_layout->LayoutSettings().HorizontalScale();
qreal const yScale = m_layout->LayoutSettings().VerticalScale();
SetPrinterSheetPageSettings(printer, sheet, xScale, yScale);
printer->setDocName(sheet->GetName());
@ -4523,13 +4523,13 @@ void VPMainWindow::on_actionPrintPreviewSheet_triggered()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionPrintTiledSheet_triggered()
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
}
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4559,13 +4559,13 @@ void VPMainWindow::on_actionPrintTiledSheet_triggered()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_actionPrintPreviewTiledSheet_triggered()
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
}
QSharedPointer<QPrinter> printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
QSharedPointer<QPrinter> const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution);
if (printer.isNull())
{
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
@ -4589,7 +4589,7 @@ void VPMainWindow::on_actionPrintPreviewTiledSheet_triggered()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_printLayoutSheet(QPrinter *printer)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -4601,7 +4601,7 @@ void VPMainWindow::on_printLayoutSheet(QPrinter *printer)
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_printLayoutSheetTiledPages(QPrinter *printer)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (sheet.isNull())
{
return;
@ -4622,7 +4622,7 @@ void VPMainWindow::EditCurrentWatermark()
{
CleanWaterkmarkEditors();
QString watermarkFile = m_layout->LayoutSettings().WatermarkPath();
QString const watermarkFile = m_layout->LayoutSettings().WatermarkPath();
if (not watermarkFile.isEmpty())
{
OpenWatermark(watermarkFile);
@ -4633,7 +4633,7 @@ void VPMainWindow::EditCurrentWatermark()
void VPMainWindow::LoadWatermark()
{
const QString filter(tr("Watermark files") + QStringLiteral(" (*.vwm)"));
QString dir = QDir::homePath();
QString const dir = QDir::homePath();
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -4685,7 +4685,7 @@ void VPMainWindow::AskDefaultSettings()
dialog.setWindowModality(Qt::WindowModal);
if (dialog.exec() == QDialog::Accepted)
{
QString locale = dialog.Locale();
QString const locale = dialog.Locale();
settings->SetLocale(locale);
VAbstractApplication::VApp()->LoadTranslation(locale);
}
@ -4786,7 +4786,7 @@ void VPMainWindow::LayoutWarningPiecesSuperposition_toggled(bool checked)
LayoutWasSaved(false);
if (checked)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->ValidateSuperpositionOfPieces();
@ -4806,7 +4806,7 @@ void VPMainWindow::LayoutWarningPiecesOutOfBound_toggled(bool checked)
if (checked)
{
VPSheetPtr sheet = m_layout->GetFocusedSheet();
VPSheetPtr const sheet = m_layout->GetFocusedSheet();
if (not sheet.isNull())
{
sheet->ValidatePiecesOutOfBound();
@ -4856,7 +4856,7 @@ void VPMainWindow::TogetherWithNotchesChanged(bool checked)
m_layout->LayoutSettings().SetBoundaryTogetherWithNotches(checked);
m_carrousel->RefreshPieceMiniature();
QList<VPSheetPtr> sheets = m_layout->GetAllSheets();
QList<VPSheetPtr> const sheets = m_layout->GetAllSheets();
for (const auto &sheet : sheets)
{
if (sheet.isNull())
@ -4864,7 +4864,7 @@ void VPMainWindow::TogetherWithNotchesChanged(bool checked)
continue;
}
QList<VPPiecePtr> pieces = sheet->GetPieces();
QList<VPPiecePtr> const pieces = sheet->GetPieces();
for (const auto &piece : pieces)
{
if (not piece.isNull())

View File

@ -30,11 +30,11 @@ auto Grayscale(QImage image) -> QImage
for (int ii = 0; ii < image.height(); ii++)
{
uchar *scan = image.scanLine(ii);
int depth = 4;
int const depth = 4;
for (int jj = 0; jj < image.width(); jj++)
{
auto *rgbpixel = reinterpret_cast<QRgb *>(scan + jj * depth); // NOLINT
int gray = qGray(*rgbpixel);
int const gray = qGray(*rgbpixel);
*rgbpixel = QColor(gray, gray, gray, qAlpha(*rgbpixel)).rgba();
}
}
@ -47,8 +47,8 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString
qreal yScale, QString &error) -> QPixmap
{
QPixmap pixmap;
QString imagePath = AbsoluteMPath(watermarkPath, watermarkData.path);
QString imageCacheKey =
QString const imagePath = AbsoluteMPath(watermarkPath, watermarkData.path);
QString const imageCacheKey =
QStringLiteral("puzzle=path%1+rotation%3+grayscale%4+xscale%5+yxcale%6")
.arg(imagePath, QString::number(watermarkData.imageRotation), watermarkData.grayscale ? trueStr : falseStr)
.arg(xScale)
@ -91,7 +91,7 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString
auto TriangleBasic() -> QPainterPath
{
// ------------- prepare triangles for position marks
QRectF rectBasic = QRectF(-UnitConvertor(0.5, Unit::Cm, Unit::Px), 0, UnitConvertor(1, Unit::Cm, Unit::Px),
QRectF const rectBasic = QRectF(-UnitConvertor(0.5, Unit::Cm, Unit::Px), 0, UnitConvertor(1, Unit::Cm, Unit::Px),
UnitConvertor(0.5, Unit::Cm, Unit::Px));
QPainterPath triangleBasic;
triangleBasic.moveTo(rectBasic.topLeft());
@ -113,11 +113,11 @@ VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonS
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::RefreshTileInfos()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
QSizeF tilesSize = layout->LayoutSettings().GetTilesSize();
QMarginsF tilesMargins = layout->LayoutSettings().GetTilesMargins();
QSizeF const tilesSize = layout->LayoutSettings().GetTilesSize();
QMarginsF const tilesMargins = layout->LayoutSettings().GetTilesMargins();
// sets the drawing height
m_drawingAreaHeight = tilesSize.height();
@ -140,7 +140,7 @@ void VPTileFactory::RefreshTileInfos()
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::RefreshWatermarkData()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
m_watermarkData = layout->WatermarkData();
@ -157,7 +157,7 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
SCASSERT(painter != nullptr)
SCASSERT(printer != nullptr)
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -260,13 +260,13 @@ auto VPTileFactory::RowNb(const VPSheetPtr &sheet) const -> int
}
qreal yScale = 1;
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
yScale = layout->LayoutSettings().VerticalScale();
}
QRectF sheetSize = sheet->GetMarginsRect();
QRectF const sheetSize = sheet->GetMarginsRect();
return qCeil(sheetSize.height() * yScale / (m_drawingAreaHeight - tileStripeWidth));
}
@ -279,13 +279,13 @@ auto VPTileFactory::ColNb(const VPSheetPtr &sheet) const -> int
}
qreal xScale = 1;
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
xScale = layout->LayoutSettings().HorizontalScale();
}
QRectF sheetSize = sheet->GetMarginsRect();
QRectF const sheetSize = sheet->GetMarginsRect();
return qCeil(sheetSize.width() * xScale / (m_drawingAreaWidth - tileStripeWidth));
}
@ -310,13 +310,13 @@ auto VPTileFactory::WatermarkData() const -> const VWatermarkData &
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
QPen rulePen(*tileColor, 1, Qt::SolidLine);
QPen const rulePen(*tileColor, 1, Qt::SolidLine);
painter->save();
painter->setPen(rulePen);
@ -324,11 +324,11 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const
const qreal notchHeight = UnitConvertor(3, Unit::Mm, Unit::Px);
const qreal shortNotchHeight = UnitConvertor(1.1, Unit::Mm, Unit::Px);
Unit layoutUnits = layout->LayoutSettings().GetUnit();
Unit rulerUnits = layoutUnits == Unit::Inch ? layoutUnits : Unit::Cm;
Unit const layoutUnits = layout->LayoutSettings().GetUnit();
Unit const rulerUnits = layoutUnits == Unit::Inch ? layoutUnits : Unit::Cm;
const qreal step = UnitConvertor(1, rulerUnits, Unit::Px);
double marksCount = (m_drawingAreaWidth - tileStripeWidth) / step;
double const marksCount = (m_drawingAreaWidth - tileStripeWidth) / step;
int i = 0;
while (i < marksCount)
{
@ -352,8 +352,8 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const
painter->setFont(fnt);
qreal unitsWidth = 0;
QFontMetrics fm(fnt);
QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit");
QFontMetrics const fm(fnt);
QString const units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit");
unitsWidth = fm.horizontalAdvance(units);
painter->drawText(QPointF(step * 0.5 - unitsWidth * 0.6,
m_drawingAreaHeight - tileStripeWidth + notchHeight + shortNotchHeight),
@ -372,7 +372,7 @@ void VPTileFactory::DrawWatermark(QPainter *painter) const
{
SCASSERT(painter != nullptr)
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -380,7 +380,7 @@ void VPTileFactory::DrawWatermark(QPainter *painter) const
if (m_watermarkData.opacity > 0)
{
QRectF img(0, 0, m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth);
QRectF const img(0, 0, m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth);
if (m_watermarkData.showImage && not m_watermarkData.path.isEmpty())
{
@ -404,7 +404,7 @@ inline auto VPTileFactory::PenTileInfos() const -> QPen
void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &sheet, int row, int col,
QPrinter *printer) const
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -416,7 +416,7 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she
sheetMargins = sheet->GetSheetMargins();
}
QPen penTileDrawing =
QPen const penTileDrawing =
QPen(Qt::black, m_commonSettings->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter->setPen(penTileDrawing);
@ -424,11 +424,11 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she
// paint the content of the page
const qreal xScale = layout->LayoutSettings().HorizontalScale();
const qreal yScale = layout->LayoutSettings().VerticalScale();
QRectF source = QRectF(sheetMargins.left() + col * (m_drawingAreaWidth - tileStripeWidth) / xScale,
QRectF const source = QRectF(sheetMargins.left() + col * (m_drawingAreaWidth - tileStripeWidth) / xScale,
sheetMargins.top() + row * (m_drawingAreaHeight - tileStripeWidth) / yScale,
m_drawingAreaWidth / xScale, m_drawingAreaHeight / yScale);
QRectF target = QRectF(0, 0, m_drawingAreaWidth, m_drawingAreaHeight);
QRectF const target = QRectF(0, 0, m_drawingAreaWidth, m_drawingAreaHeight);
sheet->SceneData()->Scene()->render(painter, VPrintLayout::SceneTargetRect(printer, target), source,
Qt::IgnoreAspectRatio);
}
@ -436,21 +436,22 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::DrawTopTriangle(QPainter *painter) const
{
QPainterPath triangleTop = QTransform().translate(m_drawingAreaWidth / 2, 0).map(TriangleBasic());
QPainterPath const triangleTop = QTransform().translate(m_drawingAreaWidth / 2, 0).map(TriangleBasic());
painter->fillPath(triangleTop, *triangleBush);
}
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::DrawLeftTriangle(QPainter *painter) const
{
QPainterPath triangleLeft = QTransform().translate(0, m_drawingAreaHeight / 2).rotate(-90).map(TriangleBasic());
QPainterPath const triangleLeft =
QTransform().translate(0, m_drawingAreaHeight / 2).rotate(-90).map(TriangleBasic());
painter->fillPath(triangleLeft, *triangleBush);
}
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::DrawBottomTriangle(QPainter *painter) const
{
QPainterPath triangleBottom = QTransform()
QPainterPath const triangleBottom = QTransform()
.translate(m_drawingAreaWidth / 2, m_drawingAreaHeight - tileStripeWidth)
.rotate(180)
.map(TriangleBasic());
@ -460,7 +461,7 @@ void VPTileFactory::DrawBottomTriangle(QPainter *painter) const
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::DrawRightTriangle(QPainter *painter) const
{
QPainterPath triangleRight = QTransform()
QPainterPath const triangleRight = QTransform()
.translate(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight / 2)
.rotate(90)
.map(TriangleBasic());
@ -623,9 +624,9 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int
td.setPageSize(QSizeF(m_drawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaWidth));
QFontMetrics metrix = QFontMetrics(td.defaultFont());
int maxWidth = metrix.horizontalAdvance(QString().fill('z', 50));
QString clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth);
QFontMetrics const metrix = QFontMetrics(td.defaultFont());
int const maxWidth = metrix.horizontalAdvance(QString().fill('z', 50));
QString const clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth);
td.setHtml(QStringLiteral("<table width='100%' style='color:rgb(%1);'>"
"<tr>"
@ -670,7 +671,7 @@ void VPTileFactory::PaintWatermarkText(QPainter *painter, const QRectF &img, con
text = t.map(text);
QPointF center = img.center() - text.boundingRect().center();
QPointF const center = img.center() - text.boundingRect().center();
t = QTransform();
t.translate(center.x(), center.y());
@ -699,15 +700,15 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
}
QPixmap watermark;
QString imagePath =
QString const imagePath =
QStringLiteral("puzzle=colorScheme%1+path%2+opacity%3_broken")
.arg(colorScheme, AbsoluteMPath(watermarkPath, watermarkData.path), QString::number(opacity));
if (not QPixmapCache::find(imagePath, &watermark))
{
QScopedPointer<QSvgRenderer> svgRenderer(new QSvgRenderer());
QScopedPointer<QSvgRenderer> const svgRenderer(new QSvgRenderer());
QRect imageRect(0, 0, qRound(img.width() / 4.), qRound(img.width() / 4.));
QRect const imageRect(0, 0, qRound(img.width() / 4.), qRound(img.width() / 4.));
watermark = QPixmap(imageRect.size());
watermark.fill(Qt::transparent);
@ -725,15 +726,15 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
return watermark;
};
QString imagePath = AbsoluteMPath(watermarkPath, watermarkData.path);
QFileInfo f(imagePath);
QString const imagePath = AbsoluteMPath(watermarkPath, watermarkData.path);
QFileInfo const f(imagePath);
QImageReader imageReader(imagePath);
QImage watermarkImage = imageReader.read();
QImage const watermarkImage = imageReader.read();
if (watermarkImage.isNull())
{
QPixmap watermarkPixmap = BrokenImage();
QPixmap const watermarkPixmap = BrokenImage();
if (watermarkPixmap.width() < img.width() && watermarkPixmap.height() < img.height())
{
@ -749,21 +750,21 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
return;
}
qint64 fileSize = watermarkImage.sizeInBytes();
qint64 pixelSize = fileSize / watermarkImage.height() / watermarkImage.width();
QSize scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale));
qint64 scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024;
int limit = QPixmapCache::cacheLimit();
qint64 const fileSize = watermarkImage.sizeInBytes();
qint64 const pixelSize = fileSize / watermarkImage.height() / watermarkImage.width();
QSize const scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale));
qint64 const scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024;
int const limit = QPixmapCache::cacheLimit();
if (scaledImageSize > limit && (xScale < 1 || yScale < 1))
{
QScopedPointer<QSvgRenderer> svgRenderer(new QSvgRenderer());
QScopedPointer<QSvgRenderer> const svgRenderer(new QSvgRenderer());
painter->save();
painter->setOpacity(opacity);
painter->restore();
QString grayscale = watermarkData.grayscale ? QStringLiteral("_grayscale") : QString();
QString const grayscale = watermarkData.grayscale ? QStringLiteral("_grayscale") : QString();
svgRenderer->load(QStringLiteral("://puzzleicon/svg/watermark_placeholder%1.svg").arg(grayscale));
QRect imageRect(0, 0, qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale));
imageRect.translate(img.center().toPoint() - imageRect.center());
@ -799,8 +800,8 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
}
else
{
QRect croppedRect = imagePosition.intersected(img.toRect());
QPixmap cropped = watermark.copy(croppedRect.translated(-imagePosition.x(), -imagePosition.y()));
QRect const croppedRect = imagePosition.intersected(img.toRect());
QPixmap const cropped = watermark.copy(croppedRect.translated(-imagePosition.x(), -imagePosition.y()));
painter->drawPixmap(croppedRect, cropped);
}

View File

@ -65,18 +65,18 @@ namespace
//---------------------------------------------------------------------------------------------------------------------
auto StringToTransfrom(const QString &matrix) -> QTransform
{
QStringList elements = matrix.split(ML::groupSep);
QStringList const elements = matrix.split(ML::groupSep);
if (elements.count() == 9)
{
qreal m11 = elements.at(0).toDouble();
qreal m12 = elements.at(1).toDouble();
qreal m13 = elements.at(2).toDouble();
qreal m21 = elements.at(3).toDouble();
qreal m22 = elements.at(4).toDouble();
qreal m23 = elements.at(5).toDouble();
qreal m31 = elements.at(6).toDouble();
qreal m32 = elements.at(7).toDouble();
qreal m33 = elements.at(8).toDouble();
qreal const m11 = elements.at(0).toDouble();
qreal const m12 = elements.at(1).toDouble();
qreal const m13 = elements.at(2).toDouble();
qreal const m21 = elements.at(3).toDouble();
qreal const m22 = elements.at(4).toDouble();
qreal const m23 = elements.at(5).toDouble();
qreal const m31 = elements.at(6).toDouble();
qreal const m32 = elements.at(7).toDouble();
qreal const m33 = elements.at(8).toDouble();
return {m11, m12, m13, m21, m22, m23, m31, m32, m33};
}
@ -86,7 +86,7 @@ auto StringToTransfrom(const QString &matrix) -> QTransform
//---------------------------------------------------------------------------------------------------------------------
auto StringToPoint(const QString &point) -> QPointF
{
QStringList coordinates = point.split(ML::coordintatesSep);
QStringList const coordinates = point.split(ML::coordintatesSep);
if (coordinates.count() == 2)
{
return {coordinates.at(0).toDouble(), coordinates.at(1).toDouble()};
@ -104,7 +104,7 @@ auto StringToPath(const QString &path) -> QVector<QPointF>
return p;
}
QStringList points = path.split(ML::pointsSep);
QStringList const points = path.split(ML::pointsSep);
p.reserve(points.size());
for (const auto &point : points)
{
@ -179,7 +179,7 @@ auto StringToGrainlineArrowDirrection(const QString &dirrection) -> GrainlineArr
//---------------------------------------------------------------------------------------------------------------------
auto StringToLine(const QString &string) -> QLineF
{
QStringList points = string.split(ML::groupSep);
QStringList const points = string.split(ML::groupSep);
if (points.count() == 2)
{
return {StringToPoint(points.at(0)), StringToPoint(points.at(1))};
@ -191,13 +191,13 @@ auto StringToLine(const QString &string) -> QLineF
//---------------------------------------------------------------------------------------------------------------------
auto StringToLines(const QString &string) -> QVector<QLineF>
{
QStringList lines = string.split(ML::itemsSep);
QStringList const lines = string.split(ML::itemsSep);
QVector<QLineF> path;
path.reserve(lines.size());
for (const auto &line : lines)
{
QLineF l = StringToLine(line);
QLineF const l = StringToLine(line);
if (not l.isNull())
{
path.append(StringToLine(line));
@ -210,7 +210,7 @@ auto StringToLines(const QString &string) -> QVector<QLineF>
//---------------------------------------------------------------------------------------------------------------------
auto StringToRect(const QString &string) -> QRectF
{
QStringList points = string.split(ML::groupSep);
QStringList const points = string.split(ML::groupSep);
if (points.count() == 4)
{
return {points.at(0).toDouble(), points.at(1).toDouble(), points.at(2).toDouble(), points.at(3).toDouble()};
@ -334,7 +334,7 @@ void VPLayoutFileReader::ReadControl(const VPLayoutPtr &layout)
{
AssertRootTag(ML::TagControl);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
layout->LayoutSettings().SetWarningSuperpositionOfPieces(
ReadAttributeBool(attribs, ML::AttrWarningSuperposition, trueStr));
layout->LayoutSettings().SetWarningPiecesOutOfBound(ReadAttributeBool(attribs, ML::AttrWarningOutOfBound, trueStr));
@ -361,7 +361,7 @@ void VPLayoutFileReader::ReadTiles(const VPLayoutPtr &layout)
{
AssertRootTag(ML::TagTiles);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
layout->LayoutSettings().SetShowTiles(ReadAttributeBool(attribs, ML::AttrVisible, falseStr));
layout->LayoutSettings().SetPrintTilesScheme(ReadAttributeBool(attribs, ML::AttrPrintScheme, falseStr));
layout->LayoutSettings().SetShowTileNumber(ReadAttributeBool(attribs, ML::AttrTileNumber, falseStr));
@ -397,7 +397,7 @@ void VPLayoutFileReader::ReadScale(const VPLayoutPtr &layout)
{
AssertRootTag(ML::TagScale);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
layout->LayoutSettings().SetHorizontalScale(ReadAttributeDouble(attribs, ML::AttrXScale, QChar('1')));
layout->LayoutSettings().SetVerticalScale(ReadAttributeDouble(attribs, ML::AttrYScale, QChar('1')));
@ -428,9 +428,9 @@ void VPLayoutFileReader::ReadSheet(const VPLayoutPtr &layout)
{
AssertRootTag(ML::TagSheet);
VPSheetPtr sheet(new VPSheet(layout));
VPSheetPtr const sheet(new VPSheet(layout));
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
sheet->SetGrainlineType(StrToGrainlineType(ReadAttributeEmptyString(attribs, ML::AttrGrainlineType)));
const QStringList tags{
@ -475,7 +475,7 @@ void VPLayoutFileReader::ReadPieces(const VPLayoutPtr &layout, const VPSheetPtr
{
if (name() == ML::TagPiece)
{
VPPiecePtr piece(new VPPiece());
VPPiecePtr const piece(new VPPiece());
ReadPiece(piece);
QString error;
@ -500,10 +500,10 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
{
AssertRootTag(ML::TagPiece);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
piece->SetName(ReadAttributeString(attribs, ML::AttrName, tr("Piece")));
QString uuidStr = ReadAttributeString(attribs, ML::AttrUID, QUuid::createUuid().toString());
QString const uuidStr = ReadAttributeString(attribs, ML::AttrUID, QUuid::createUuid().toString());
piece->SetUUID(QUuid(uuidStr));
piece->SetGradationId(ReadAttributeEmptyString(attribs, ML::AttrGradationLabel));
@ -575,7 +575,7 @@ auto VPLayoutFileReader::ReadLayoutPoint() -> VLayoutPoint
VLayoutPoint point;
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
point.setX(ReadAttributeDouble(attribs, ML::AttrX, QChar('0')));
point.setY(ReadAttributeDouble(attribs, ML::AttrY, QChar('0')));
point.SetTurnPoint(ReadAttributeBool(attribs, ML::AttrTurnPoint, falseStr));
@ -619,14 +619,14 @@ void VPLayoutFileReader::ReadSeamAllowance(const VPPiecePtr &piece)
{
AssertRootTag(ML::TagSeamAllowance);
QXmlStreamAttributes attribs = attributes();
bool enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr);
QXmlStreamAttributes const attribs = attributes();
bool const enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr);
piece->SetSeamAllowance(enabled);
bool builtIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr);
bool const builtIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr);
piece->SetSeamAllowanceBuiltIn(builtIn);
QVector<VLayoutPoint> path = ReadLayoutPoints();
QVector<VLayoutPoint> const path = ReadLayoutPoints();
if (enabled && not builtIn)
{
@ -645,14 +645,14 @@ void VPLayoutFileReader::ReadGrainline(const VPPiecePtr &piece)
VPieceGrainline grainline;
QXmlStreamAttributes attribs = attributes();
bool enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr);
QXmlStreamAttributes const attribs = attributes();
bool const enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr);
grainline.SetEnabled(enabled);
QLineF mainLine = StringToLine(readElementText());
QLineF const mainLine = StringToLine(readElementText());
if (enabled)
{
QString arrowDirection = ReadAttributeEmptyString(attribs, ML::AttrArrowDirection);
QString const arrowDirection = ReadAttributeEmptyString(attribs, ML::AttrArrowDirection);
grainline.SetArrowType(StringToGrainlineArrowDirrection(arrowDirection));
if (mainLine.isNull())
@ -693,7 +693,7 @@ auto VPLayoutFileReader::ReadNotch() -> VLayoutPassmark
{
AssertRootTag(ML::TagNotch);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
@ -704,7 +704,7 @@ auto VPLayoutFileReader::ReadNotch() -> VLayoutPassmark
passmark.lines = StringToLines(ReadAttributeEmptyString(attribs, ML::AttrPath));
passmark.isClockwiseOpening = ReadAttributeBool(attribs, ML::AttrClockwiseOpening, falseStr);
QString defaultType = QString::number(static_cast<int>(PassmarkLineType::OneLine));
QString const defaultType = QString::number(static_cast<int>(PassmarkLineType::OneLine));
passmark.type = static_cast<PassmarkLineType>(ReadAttributeUInt(attribs, ML::AttrType, defaultType));
QT_WARNING_POP
@ -839,7 +839,7 @@ void VPLayoutFileReader::ReadPieceLabel(const VPPiecePtr &piece)
{
AssertRootTag(ML::TagPieceLabel);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
piece->SetPieceLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape)));
while (readNextStartElement())
@ -861,7 +861,7 @@ void VPLayoutFileReader::ReadPatternLabel(const VPPiecePtr &piece)
{
AssertRootTag(ML::TagPatternLabel);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
piece->SetPatternLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape)));
while (readNextStartElement())
@ -886,10 +886,10 @@ auto VPLayoutFileReader::ReadLabelLines() -> VTextManager
VTextManager text;
QVector<TextLine> lines;
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
text.SetFont(FontFromString(ReadAttributeEmptyString(attribs, ML::AttrFont)));
QStringList svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(',');
QStringList const svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(',');
if (!svgFontData.isEmpty())
{
text.SetSVGFontFamily(svgFontData.constFirst());
@ -925,13 +925,14 @@ auto VPLayoutFileReader::ReadLabelLine() -> TextLine
TextLine line;
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
line.m_iFontSize =
ReadAttributeInt(attribs, ML::AttrFontSize, QString::number(VCommonSettings::MinPieceLabelFontPointSize()));
line.m_bold = ReadAttributeBool(attribs, ML::AttrBold, falseStr);
line.m_italic = ReadAttributeBool(attribs, ML::AttrItalic, falseStr);
int alignment = ReadAttributeInt(attribs, ML::AttrAlignment, QString::number(static_cast<int>(Qt::AlignCenter)));
int const alignment =
ReadAttributeInt(attribs, ML::AttrAlignment, QString::number(static_cast<int>(Qt::AlignCenter)));
line.m_eAlign = static_cast<Qt::Alignment>(alignment);
line.m_qsText = readElementText();
@ -943,7 +944,7 @@ void VPLayoutFileReader::ReadWatermark(const VPLayoutPtr &layout)
{
AssertRootTag(ML::TagWatermark);
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
layout->LayoutSettings().SetShowWatermark(ReadAttributeBool(attribs, ML::AttrShowPreview, falseStr));
layout->LayoutSettings().SetWatermarkPath(readElementText());
}
@ -999,7 +1000,7 @@ void VPLayoutFileReader::ReadMirrorLines(const VPPiecePtr &piece)
//---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileReader::ReadLayoutMargins(const VPLayoutPtr &layout)
{
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
QMarginsF margins = QMarginsF();
margins.setLeft(ReadAttributeDouble(attribs, ML::AttrLeft, QChar('0')));
@ -1016,7 +1017,7 @@ void VPLayoutFileReader::ReadLayoutMargins(const VPLayoutPtr &layout)
//---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileReader::ReadSheetMargins(const VPSheetPtr &sheet)
{
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
QMarginsF margins = QMarginsF();
margins.setLeft(ReadAttributeDouble(attribs, ML::AttrLeft, QChar('0')));
@ -1035,7 +1036,7 @@ auto VPLayoutFileReader::ReadSize() -> QSizeF
{
QSizeF size;
QXmlStreamAttributes attribs = attributes();
QXmlStreamAttributes const attribs = attributes();
size.setWidth(ReadAttributeDouble(attribs, ML::AttrWidth, QChar('0')));
size.setHeight(ReadAttributeDouble(attribs, ML::AttrLength, QChar('0')));

View File

@ -51,7 +51,7 @@ template <class T> auto NumberToString(T number) -> QString
//---------------------------------------------------------------------------------------------------------------------
auto TransformToString(const QTransform &m) -> QString
{
QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
QStringList const matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()),
NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())};
return matrix.join(ML::groupSep);
@ -201,7 +201,7 @@ void VPLayoutFileWriter::WriteSheets(const VPLayoutPtr &layout)
{
writeStartElement(ML::TagSheets);
QList<VPSheetPtr> sheets = layout->GetSheets();
QList<VPSheetPtr> const sheets = layout->GetSheets();
for (const auto &sheet : sheets)
{
if (not sheet.isNull())
@ -292,7 +292,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
[](bool show) noexcept { return show; });
writeStartElement(ML::TagSeamLine);
QVector<VLayoutPoint> contourPoints = piece->GetContourPoints();
QVector<VLayoutPoint> const contourPoints = piece->GetContourPoints();
for (auto &point : contourPoints)
{
WriteLayoutPoint(point);
@ -306,7 +306,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
[](bool builtin) noexcept { return not builtin; });
if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn())
{
QVector<VLayoutPoint> seamAllowancePoints = piece->GetSeamAllowancePoints();
QVector<VLayoutPoint> const seamAllowancePoints = piece->GetSeamAllowancePoints();
for (auto &point : seamAllowancePoints)
{
WriteLayoutPoint(point);
@ -325,7 +325,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
writeEndElement();
writeStartElement(ML::TagNotches);
QVector<VLayoutPassmark> passmarks = piece->GetPassmarks();
QVector<VLayoutPassmark> const passmarks = piece->GetPassmarks();
for (const auto &passmark : passmarks)
{
writeStartElement(ML::TagNotch);
@ -340,7 +340,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
writeEndElement();
writeStartElement(ML::TagInternalPaths);
QVector<VLayoutPiecePath> internalPaths = piece->GetInternalPaths();
QVector<VLayoutPiecePath> const internalPaths = piece->GetInternalPaths();
for (const auto &path : internalPaths)
{
writeStartElement(ML::TagInternalPath);
@ -349,7 +349,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
SetAttributeOrRemoveIf<bool>(ML::AttrNotMirrored, path.IsNotMirrored(),
[](bool mirrored) noexcept { return mirrored; });
QVector<VLayoutPoint> points = path.Points();
QVector<VLayoutPoint> const points = path.Points();
for (auto &point : points)
{
WriteLayoutPoint(point);
@ -360,7 +360,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
writeEndElement();
writeStartElement(ML::TagMarkers);
QVector<VLayoutPlaceLabel> placelabels = piece->GetPlaceLabels();
QVector<VLayoutPlaceLabel> const placelabels = piece->GetPlaceLabels();
for (const auto &label : placelabels)
{
writeStartElement(ML::TagMarker);

View File

@ -117,7 +117,7 @@ void TapePreferencesPathPage::EditPath()
}
bool usedNotExistedDir = false;
QDir directory(path);
QDir const directory(path);
if (not directory.exists())
{
usedNotExistedDir = directory.mkpath(QChar('.'));

View File

@ -72,8 +72,8 @@ void DialogDimensionCustomNames::InitTable(const QMap<MeasurementDimension, Meas
while (i != dimensions.constEnd())
{
{
QString name = QStringLiteral("%1 (%2)").arg(VAbstartMeasurementDimension::DimensionName(i.value()->Type()),
i.value()->Axis());
QString const name = QStringLiteral("%1 (%2)").arg(
VAbstartMeasurementDimension::DimensionName(i.value()->Type()), i.value()->Axis());
auto *itemValue = new QTableWidgetItem(name);
itemValue->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);

View File

@ -58,12 +58,12 @@ void DialogDimensionLabels::changeEvent(QEvent *event)
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
MeasurementDimension type =
MeasurementDimension const type =
static_cast<MeasurementDimension>(ui->comboBoxDimensionLabels->currentData().toInt());
InitDimensions();
int index = ui->comboBoxDimensionLabels->findData(static_cast<int>(type));
int const index = ui->comboBoxDimensionLabels->findData(static_cast<int>(type));
if (index != -1)
{
ui->comboBoxDimensionLabels->blockSignals(true);
@ -94,9 +94,9 @@ void DialogDimensionLabels::LabelChanged(QTableWidgetItem *item)
{
if (item != nullptr)
{
MeasurementDimension type =
MeasurementDimension const type =
static_cast<MeasurementDimension>(ui->comboBoxDimensionLabels->currentData().toInt());
qreal value = item->data(Qt::UserRole).toDouble();
qreal const value = item->data(Qt::UserRole).toDouble();
DimesionLabels labels = m_labels.value(type);
labels.insert(value, item->text());

View File

@ -181,7 +181,7 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column)
if (item->childCount() != 0 && item->checkState(0) != Qt::PartiallyChecked && column != -1)
{
bool flag = false; // Check if we could change atleast one children
Qt::CheckState checkState = item->checkState(0);
Qt::CheckState const checkState = item->checkState(0);
for (int i = 0; i < item->childCount(); ++i)
{
if (not m_usedMeasurements.contains(item->child(i)->data(0, Qt::UserRole).toString()))
@ -303,19 +303,19 @@ void DialogMDataBase::InitDataBase(const QStringList &usedMeasurements)
}
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_knownId);
VKnownMeasurements const knownDB = db->KnownMeasurements(m_knownId);
QMap<int, VKnownMeasurement> measurements = knownDB.OrderedGroupMeasurements(QString());
QMap<int, VKnownMeasurement> const measurements = knownDB.OrderedGroupMeasurements(QString());
if (!measurements.isEmpty())
{
m_generalGroup = InitGroup(tr("General", "Measurement section"), measurements, usedMeasurements);
m_groups.append(m_generalGroup);
}
QStringList groups = knownDB.Groups();
QStringList const groups = knownDB.Groups();
for (auto &group : groups)
{
QMap<int, VKnownMeasurement> groupMeasurements = knownDB.OrderedGroupMeasurements(group);
QMap<int, VKnownMeasurement> const groupMeasurements = knownDB.OrderedGroupMeasurements(group);
m_groups.append(InitGroup(group, groupMeasurements, usedMeasurements));
}
}
@ -431,8 +431,8 @@ auto DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showImage)
}
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_knownId);
VKnownMeasurement known = knownDB.Measurement(name);
VKnownMeasurements const knownDB = db->KnownMeasurements(m_knownId);
VKnownMeasurement const known = knownDB.Measurement(name);
QString imgTag;
if (showImage)

View File

@ -264,7 +264,7 @@ auto DialogMeasurementsCSVColumns::ColumnHeader(int column) const -> QString
case MultisizeMeasurementsColumns::ShiftA:
if (not m_dimensions.empty())
{
MeasurementDimension_p dimension = m_dimensions.at(0);
MeasurementDimension_p const dimension = m_dimensions.at(0);
return QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") +
suffix.arg(dimension->Name());
}
@ -275,7 +275,7 @@ auto DialogMeasurementsCSVColumns::ColumnHeader(int column) const -> QString
case MultisizeMeasurementsColumns::ShiftB:
if (m_dimensions.size() > 1)
{
MeasurementDimension_p dimension = m_dimensions.at(1);
MeasurementDimension_p const dimension = m_dimensions.at(1);
return QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") +
suffix.arg(dimension->Name());
}
@ -286,7 +286,7 @@ auto DialogMeasurementsCSVColumns::ColumnHeader(int column) const -> QString
case MultisizeMeasurementsColumns::ShiftC:
if (m_dimensions.size() > 2)
{
MeasurementDimension_p dimension = m_dimensions.at(2);
MeasurementDimension_p const dimension = m_dimensions.at(2);
return QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") +
suffix.arg(dimension->Name());
}
@ -433,7 +433,7 @@ void DialogMeasurementsCSVColumns::ClearColumnCollor()
//---------------------------------------------------------------------------------------------------------------------
void DialogMeasurementsCSVColumns::InitColumnsMap()
{
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogMeasurementsCSVColumns::CSVModel();
m_columnsMap.clear();
auto InitColumn = [this, csv](int column, int &index, bool forceSkip = false)
@ -618,7 +618,7 @@ void DialogMeasurementsCSVColumns::ShowInputPreview()
return;
}
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogMeasurementsCSVColumns::CSVModel();
const int columns = csv->columnCount();
const int rows = csv->rowCount();
@ -667,7 +667,7 @@ void DialogMeasurementsCSVColumns::ShowImportPreview()
return;
}
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogMeasurementsCSVColumns::CSVModel();
const int importColumns = ImportColumnCount();
const int columns = csv->columnCount();
@ -750,7 +750,7 @@ void DialogMeasurementsCSVColumns::RetranslateLabels()
if (not m_dimensions.empty())
{
MeasurementDimension_p dimension = m_dimensions.at(0);
MeasurementDimension_p const dimension = m_dimensions.at(0);
ui->labelShiftA->setText(
QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") +
suffix.arg(dimension->Name()));
@ -758,7 +758,7 @@ void DialogMeasurementsCSVColumns::RetranslateLabels()
if (m_dimensions.size() > 1)
{
MeasurementDimension_p dimension = m_dimensions.at(1);
MeasurementDimension_p const dimension = m_dimensions.at(1);
ui->labelShiftB->setText(
QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") +
suffix.arg(dimension->Name()));
@ -766,7 +766,7 @@ void DialogMeasurementsCSVColumns::RetranslateLabels()
if (m_dimensions.size() > 2)
{
MeasurementDimension_p dimension = m_dimensions.at(2);
MeasurementDimension_p const dimension = m_dimensions.at(2);
ui->labelShiftC->setText(
QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") +
suffix.arg(dimension->Name()));
@ -781,7 +781,7 @@ void DialogMeasurementsCSVColumns::SetDefaultColumns()
{
SCASSERT(control != nullptr)
int index = control->findData(m_columnsMap.at(column));
int const index = control->findData(m_columnsMap.at(column));
if (index != -1)
{
control->setCurrentIndex(index);
@ -838,7 +838,7 @@ void DialogMeasurementsCSVColumns::CheckStatus()
return;
}
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogMeasurementsCSVColumns::CSVModel();
const int columns = csv->columnCount();
if (columns < MinimumColumns())
@ -881,7 +881,7 @@ template <class T> void DialogMeasurementsCSVColumns::HackWidget(T **widget)
template <class T> auto DialogMeasurementsCSVColumns::ColumnValid(T column) const -> bool
{
const int columnNumber = static_cast<int>(column);
int value = m_columnsMap.at(columnNumber);
int const value = m_columnsMap.at(columnNumber);
if (value == -1 && not ColumnMandatory(columnNumber))
{

View File

@ -112,7 +112,7 @@ void DialogNewMeasurements::InitMTypes()
ui->comboBoxMType->addItem(tr("Multisize"), static_cast<int>(MeasurementsType::Multisize));
ui->comboBoxMType->blockSignals(false);
int index = ui->comboBoxMType->findData(val);
int const index = ui->comboBoxMType->findData(val);
if (index != -1)
{
ui->comboBoxMType->setCurrentIndex(index);

View File

@ -188,7 +188,7 @@ void DialogRestrictDimension::changeEvent(QEvent *event)
if (m_dimensions.size() > index)
{
MeasurementDimension_p dimension = m_dimensions.at(index);
MeasurementDimension_p const dimension = m_dimensions.at(index);
name->setText(dimension->Name() + ':'_L1);
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_fullCircumference));
@ -240,7 +240,7 @@ void DialogRestrictDimension::RowSelected()
}
}
VDimensionRestriction restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2));
VDimensionRestriction const restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2));
if (dimension.isNull())
{
@ -251,7 +251,8 @@ void DialogRestrictDimension::RowSelected()
ui->comboBoxMin->blockSignals(true);
ui->comboBoxMin->clear();
QVector<qreal> filtered = FilterByMinimum(FilterByMaximum(bases, restriction.GetMax()), restriction.GetMin());
QVector<qreal> const filtered =
FilterByMinimum(FilterByMaximum(bases, restriction.GetMax()), restriction.GetMin());
FillBases(filtered, dimension, ui->comboBoxMin);
int index = ui->comboBoxMin->findData(restriction.GetMin());
ui->comboBoxMin->setCurrentIndex(index != -1 ? index : 0);
@ -380,7 +381,7 @@ void DialogRestrictDimension::CellContextMenu(QPoint pos)
dimension = m_dimensions.at(1);
columnValue = dimension->ValidBases().at(item->column());
qreal base1 = m_dimensions.at(0)->ValidBases().at(item->row());
qreal const base1 = m_dimensions.at(0)->ValidBases().at(item->row());
coordinates = VMeasurement::CorrectionHash(base1);
}
else if (m_restrictionType == RestrictDimension::Third)
@ -392,14 +393,14 @@ void DialogRestrictDimension::CellContextMenu(QPoint pos)
dimension = m_dimensions.at(2);
columnValue = dimension->ValidBases().at(item->column());
qreal base1 = ui->comboBoxDimensionA->currentData().toDouble();
qreal base2 = m_dimensions.at(1)->ValidBases().at(item->row());
qreal const base1 = ui->comboBoxDimensionA->currentData().toDouble();
qreal const base2 = m_dimensions.at(1)->ValidBases().at(item->row());
coordinates = VMeasurement::CorrectionHash(base1, base2);
}
VDimensionRestriction restriction = m_restrictions.value(coordinates);
bool exclude = not VFuzzyContains(restriction.GetExcludeValues(), columnValue);
QScopedPointer<QMenu> menu(new QMenu());
bool const exclude = not VFuzzyContains(restriction.GetExcludeValues(), columnValue);
QScopedPointer<QMenu> const menu(new QMenu());
QAction *actionExclude = menu->addAction(exclude ? tr("Exclude") : tr("Include"));
if (m_restrictionType == RestrictDimension::Second || m_restrictionType == RestrictDimension::Third)
@ -453,7 +454,7 @@ void DialogRestrictDimension::InitDimensionsBaseValues()
if (m_dimensions.size() > index)
{
MeasurementDimension_p dimension = m_dimensions.at(index);
MeasurementDimension_p const dimension = m_dimensions.at(index);
name->setText(dimension->Name() + ':'_L1);
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_fullCircumference));
@ -502,7 +503,7 @@ void DialogRestrictDimension::InitDimensionGradation(const MeasurementDimension_
FillBases(DimensionRestrictedValues(dimension), dimension, control);
int i = control->findData(current);
int const i = control->findData(current);
if (i != -1)
{
control->setCurrentIndex(i);
@ -525,7 +526,7 @@ void DialogRestrictDimension::InitTable()
{
if (m_dimensions.size() > index)
{
MeasurementDimension_p dimension = m_dimensions.at(index);
MeasurementDimension_p const dimension = m_dimensions.at(index);
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setRowCount(static_cast<int>(bases.size()));
ui->tableWidget->setVerticalHeaderLabels(DimensionLabels(bases, dimension));
@ -536,7 +537,7 @@ void DialogRestrictDimension::InitTable()
{
if (m_dimensions.size() > index)
{
MeasurementDimension_p dimension = m_dimensions.at(index);
MeasurementDimension_p const dimension = m_dimensions.at(index);
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setColumnCount(static_cast<int>(bases.size()));
ui->tableWidget->setHorizontalHeaderLabels(DimensionLabels(bases, dimension));
@ -575,7 +576,7 @@ void DialogRestrictDimension::RefreshTable()
{
if (not m_dimensions.empty())
{
MeasurementDimension_p dimensionA = m_dimensions.at(0);
MeasurementDimension_p const dimensionA = m_dimensions.at(0);
basesColumn = dimensionA->ValidBases();
}
else
@ -587,10 +588,10 @@ void DialogRestrictDimension::RefreshTable()
{
if (m_dimensions.size() >= 2)
{
MeasurementDimension_p dimensionA = m_dimensions.at(0);
MeasurementDimension_p const dimensionA = m_dimensions.at(0);
basesRow = dimensionA->ValidBases();
MeasurementDimension_p dimensionB = m_dimensions.at(1);
MeasurementDimension_p const dimensionB = m_dimensions.at(1);
basesColumn = dimensionB->ValidBases();
}
else
@ -602,10 +603,10 @@ void DialogRestrictDimension::RefreshTable()
{
if (m_dimensions.size() >= 3)
{
MeasurementDimension_p dimensionB = m_dimensions.at(1);
MeasurementDimension_p const dimensionB = m_dimensions.at(1);
basesRow = dimensionB->ValidBases();
MeasurementDimension_p dimensionC = m_dimensions.at(2);
MeasurementDimension_p const dimensionC = m_dimensions.at(2);
basesColumn = dimensionC->ValidBases();
}
else
@ -653,7 +654,7 @@ void DialogRestrictDimension::AddCell(int row, int column, qreal rowValue, qreal
if (m_restrictionType == RestrictDimension::First)
{
VDimensionRestriction restriction = m_restrictions.value(QChar('0'));
VDimensionRestriction const restriction = m_restrictions.value(QChar('0'));
item->setIcon(QIcon(VFuzzyContains(restriction.GetExcludeValues(), columnValue)
? QStringLiteral("://icon/24x24/close.png")
: QStringLiteral("://icon/24x24/star.png")));
@ -690,7 +691,7 @@ void DialogRestrictDimension::AddCell(int row, int column, qreal rowValue, qreal
}
}
VDimensionRestriction restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2));
VDimensionRestriction const restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2));
qreal min = INT32_MIN;
qreal max = INT32_MAX;
@ -745,7 +746,7 @@ void DialogRestrictDimension::FillBase(double base, const MeasurementDimension_p
if (dimension->Type() == MeasurementDimension::X)
{
QString item = useLabel ? label : QStringLiteral("%1 %2").arg(base).arg(units);
QString const item = useLabel ? label : QStringLiteral("%1 %2").arg(base).arg(units);
control->addItem(item, base);
}
else if (dimension->Type() == MeasurementDimension::Y)
@ -756,7 +757,7 @@ void DialogRestrictDimension::FillBase(double base, const MeasurementDimension_p
}
else
{
QString item = dimension->IsBodyMeasurement()
QString const item = dimension->IsBodyMeasurement()
? QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units)
: QString::number(base);
control->addItem(item, base);
@ -764,7 +765,8 @@ void DialogRestrictDimension::FillBase(double base, const MeasurementDimension_p
}
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
{
QString item = useLabel ? label : QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units);
QString const item =
useLabel ? label : QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units);
control->addItem(item, base);
}
}
@ -888,7 +890,7 @@ auto DialogRestrictDimension::DimensionRestrictedValues(const MeasurementDimensi
}
else if (m_restrictionType == RestrictDimension::Third)
{
qreal base1 = ui->comboBoxDimensionA->currentData().toDouble();
qreal const base1 = ui->comboBoxDimensionA->currentData().toDouble();
restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1));
}
@ -918,10 +920,10 @@ auto DialogRestrictDimension::StartRow() const -> int
if (m_dimensions.size() >= 3)
{
MeasurementDimension_p dimensionB = m_dimensions.at(1);
MeasurementDimension_p const dimensionB = m_dimensions.at(1);
basesRow = dimensionB->ValidBases();
QVector<qreal> validRows = DimensionRestrictedValues(dimensionB);
QVector<qreal> const validRows = DimensionRestrictedValues(dimensionB);
for (int i = 0; i < basesRow.size(); ++i)
{

View File

@ -300,7 +300,7 @@ void DialogSetupMultisize::ShowFullCircumference()
//---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::XDimensionBodyMeasurementChanged()
{
bool checked = ui->checkBoxXDimensionBodyMeasurement->isChecked();
bool const checked = ui->checkBoxXDimensionBodyMeasurement->isChecked();
m_xDimension->SetBodyMeasurement(checked);
InitDimension(ui->doubleSpinBoxXDimensionMinValue, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
@ -322,7 +322,7 @@ void DialogSetupMultisize::XDimensionBodyMeasurementChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::YDimensionBodyMeasurementChanged()
{
bool checked = ui->checkBoxYDimensionBodyMeasurement->isChecked();
bool const checked = ui->checkBoxYDimensionBodyMeasurement->isChecked();
m_yDimension->SetBodyMeasurement(checked);
InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
@ -344,7 +344,7 @@ void DialogSetupMultisize::YDimensionBodyMeasurementChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::WDimensionBodyMeasurementChanged()
{
bool checked = ui->checkBoxWDimensionBodyMeasurement->isChecked();
bool const checked = ui->checkBoxWDimensionBodyMeasurement->isChecked();
m_wDimension->SetBodyMeasurement(checked);
InitDimension(ui->doubleSpinBoxWDimensionMinValue, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
@ -366,7 +366,7 @@ void DialogSetupMultisize::WDimensionBodyMeasurementChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::ZDimensionBodyMeasurementChanged()
{
bool checked = ui->checkBoxZDimensionBodyMeasurement->isChecked();
bool const checked = ui->checkBoxZDimensionBodyMeasurement->isChecked();
m_zDimension->SetBodyMeasurement(checked);
InitDimension(ui->doubleSpinBoxZDimensionMinValue, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,

View File

@ -94,7 +94,7 @@ void DialogTapePreferences::showEvent(QShowEvent *event)
}
// do your init stuff here
QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
QSize const sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@ -169,6 +169,6 @@ void DialogTapePreferences::PageChanged(QListWidgetItem *current, QListWidgetIte
{
current = previous;
}
int rowIndex = ui->contentsWidget->row(current);
int const rowIndex = ui->contentsWidget->row(current);
ui->pagesWidget->setCurrentIndex(rowIndex);
}

View File

@ -313,7 +313,7 @@ MApplication::~MApplication()
{
auto *statistic = VGAnalytics::Instance();
QString clientID = settings->GetClientID();
QString const clientID = settings->GetClientID();
if (!clientID.isEmpty())
{
statistic->SendAppCloseEvent(m_uptimeTimer.elapsed());
@ -468,7 +468,7 @@ void MApplication::InitOptions()
QTimer::singleShot(0, this,
[]()
{
QString country = VGAnalytics::CountryCode();
QString const country = VGAnalytics::CountryCode();
if (country == "ru"_L1 || country == "by"_L1)
{
qFatal("country not detected");
@ -639,7 +639,7 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
}
const QStringList args = parser.positionalArguments();
bool success = args.count() > 0 ? StartWithFiles(parser) : SingleStart(parser);
bool const success = args.count() > 0 ? StartWithFiles(parser) : SingleStart(parser);
if (not success)
{
@ -686,7 +686,7 @@ void MApplication::Preferences(QWidget *parent)
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
auto *preferences = new DialogTapePreferences(parent);
// QScopedPointer needs to be sure any exception will never block guard
QScopedPointer<DialogTapePreferences> dlg(preferences);
QScopedPointer<DialogTapePreferences> const dlg(preferences);
guard = preferences;
// Must be first

View File

@ -384,7 +384,7 @@ void TKMMainWindow::changeEvent(QEvent *event)
InitMeasurementDiagramList();
int i = ui->comboBoxDiagram->findData(current);
int const i = ui->comboBoxDiagram->findData(current);
if (i != -1)
{
ui->comboBoxDiagram->setCurrentIndex(i);
@ -453,7 +453,7 @@ void TKMMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, in
{
QxtCsvModel csv;
int columns = 5;
int const columns = 5;
int colCount = 0;
for (int column = 0; column <= columns; ++column)
{
@ -524,7 +524,7 @@ void TKMMainWindow::OpenKnownMeasurements()
{
const QString filter = tr("Known measurements") + " (*.vkm);;"_L1 + tr("All files") + " (*.*)"_L1;
// Use standard path to known measurements
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathKnownMeasurements();
QString const pathTo = MApplication::VApp()->TapeSettings()->GetPathKnownMeasurements();
Open(pathTo, filter);
}
@ -576,17 +576,17 @@ auto TKMMainWindow::FileSave() -> bool
//---------------------------------------------------------------------------------------------------------------------
auto TKMMainWindow::FileSaveAs() -> bool
{
QString filters = tr("Known measurements") + QStringLiteral(" (*.vkm)");
QString const filters = tr("Known measurements") + QStringLiteral(" (*.vkm)");
QString fName = tr("known measurements");
QString suffix = QStringLiteral("vkm");
QString const suffix = QStringLiteral("vkm");
fName += '.'_L1 + suffix;
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
const QString dir = settings->GetPathKnownMeasurements();
QDir directory(dir);
QDir const directory(dir);
if (not directory.exists())
{
directory.mkpath(QChar('.'));
@ -605,7 +605,7 @@ auto TKMMainWindow::FileSaveAs() -> bool
return false;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += '.'_L1 + suffix;
@ -614,7 +614,7 @@ auto TKMMainWindow::FileSaveAs() -> bool
if (QFileInfo::exists(fileName) && m_curFile != fileName)
{
// Temporary try to lock the file before saving
VLockGuard<char> tmp(fileName);
VLockGuard<char> const tmp(fileName);
if (not tmp.IsLocked())
{
qCCritical(kmMainWindow, "%s",
@ -630,7 +630,7 @@ auto TKMMainWindow::FileSaveAs() -> bool
m_mIsReadOnly = false;
QString error;
bool result = SaveKnownMeasurements(fileName, error);
bool const result = SaveKnownMeasurements(fileName, error);
if (not result)
{
QMessageBox messageBox;
@ -710,7 +710,7 @@ void TKMMainWindow::ImportDataFromCSV()
return;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += '.'_L1 + suffix;
@ -735,7 +735,7 @@ void TKMMainWindow::ImportDataFromCSV()
if (columns->exec() == QDialog::Accepted)
{
QxtCsvModel csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(),
QxtCsvModel const csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(),
VTextCodec::codecForMib(dialog.GetSelectedMib()));
const QVector<int> map = columns->ColumnsMap();
ImportKnownMeasurements(csv, map, dialog.IsWithHeader());
@ -910,7 +910,7 @@ void TKMMainWindow::AddImage()
settings->SetPathCustomImage(QFileInfo(filePath).absolutePath());
}
VPatternImage image = VPatternImage::FromFile(filePath);
VPatternImage const image = VPatternImage::FromFile(filePath);
if (not image.IsValid())
{
@ -973,9 +973,9 @@ void TKMMainWindow::SaveImage()
return;
}
QMap<QUuid, VPatternImage> images = m_known.Images();
QMap<QUuid, VPatternImage> const images = m_known.Images();
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
if (!images.contains(id))
{
ui->toolButtonSaveImage->setDisabled(true);
@ -992,7 +992,7 @@ void TKMMainWindow::SaveImage()
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
QMimeType mime = image.MimeTypeFromData();
QMimeType const mime = image.MimeTypeFromData();
QString title = image.Title();
if (title.isEmpty())
@ -1001,14 +1001,14 @@ void TKMMainWindow::SaveImage()
}
QString path = settings->GetPathCustomImage() + QDir::separator() + title;
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
path += '.'_L1 + suffixes.at(0);
}
QString filter = mime.filterString();
QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
QString const filter = mime.filterString();
QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (not filename.isEmpty())
{
@ -1039,9 +1039,9 @@ void TKMMainWindow::ShowImage()
return;
}
QMap<QUuid, VPatternImage> images = m_known.Images();
QMap<QUuid, VPatternImage> const images = m_known.Images();
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
if (!images.contains(id))
{
return;
@ -1055,10 +1055,10 @@ void TKMMainWindow::ShowImage()
return;
}
QMimeType mime = image.MimeTypeFromData();
QMimeType const mime = image.MimeTypeFromData();
QString name = QDir::tempPath() + QDir::separator() + "image.XXXXXX"_L1;
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
name += '.'_L1 + suffixes.at(0);
@ -1130,7 +1130,7 @@ void TKMMainWindow::ShowMData()
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); // name
SCASSERT(nameField != nullptr)
VKnownMeasurement m = m_known.Measurement(nameField->data(Qt::UserRole).toString());
VKnownMeasurement const m = m_known.Measurement(nameField->data(Qt::UserRole).toString());
ShowMDiagram(m_known.Image(m.diagram));
@ -1185,8 +1185,8 @@ void TKMMainWindow::ShowImageData()
ImageFields(true);
const QListWidgetItem *activeImage = ui->listWidget->item(ui->listWidget->currentRow());
QUuid imageId = activeImage->data(Qt::UserRole).toUuid();
VPatternImage image = m_known.Image(imageId);
QUuid const imageId = activeImage->data(Qt::UserRole).toUuid();
VPatternImage const image = m_known.Image(imageId);
// Don't block all signal for QLineEdit. Need for correct handle with clear button.
disconnect(ui->lineEditImageTitle, &QLineEdit::editingFinished, this, &TKMMainWindow::SaveImageTitle);
@ -1243,7 +1243,7 @@ void TKMMainWindow::SaveMName()
QString newName = ui->lineEditName->text().isEmpty() ? GenerateMeasurementName() : ui->lineEditName->text();
QHash<QString, VKnownMeasurement> m = m_known.Measurements();
QHash<QString, VKnownMeasurement> const m = m_known.Measurements();
if (m.contains(newName))
{
qint32 num = 2;
@ -1279,7 +1279,7 @@ void TKMMainWindow::SaveMFormula()
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
QString formula = ui->plainTextEditFormula->toPlainText();
QString const formula = ui->plainTextEditFormula->toPlainText();
m_m->SetMFormula(nameField->data(Qt::UserRole).toString(), formula);
MeasurementsWereSaved(false);
@ -1428,7 +1428,7 @@ void TKMMainWindow::SaveMDiagram()
void TKMMainWindow::SaveImageTitle()
{
auto *item = ui->listWidget->currentItem();
int row = ui->listWidget->currentRow();
int const row = ui->listWidget->currentRow();
if (item == nullptr)
{
@ -1453,7 +1453,7 @@ void TKMMainWindow::SaveImageTitle()
void TKMMainWindow::SaveImageSizeScale()
{
auto *item = ui->listWidget->currentItem();
int row = ui->listWidget->currentRow();
int const row = ui->listWidget->currentRow();
if (item == nullptr)
{
@ -1507,7 +1507,7 @@ void TKMMainWindow::AskDefaultSettings()
dialog.setWindowModality(Qt::WindowModal);
if (dialog.exec() == QDialog::Accepted)
{
QString locale = dialog.Locale();
QString const locale = dialog.Locale();
settings->SetLocale(locale);
VAbstractApplication::VApp()->LoadTranslation(locale);
}
@ -1923,7 +1923,7 @@ auto TKMMainWindow::MaybeSave() -> bool
return true; // Don't ask if file was created without modifications.
}
QScopedPointer<QMessageBox> messageBox(
QScopedPointer<QMessageBox> const messageBox(
new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"),
tr("Measurements have been modified. Do you want to save your changes?"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet));
@ -2042,17 +2042,17 @@ void TKMMainWindow::WriteSettings()
//---------------------------------------------------------------------------------------------------------------------
void TKMMainWindow::InitIcons()
{
QString iconResource = QStringLiteral("icon");
QString const iconResource = QStringLiteral("icon");
ui->toolButtonAddImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/insert-image.png")));
ui->toolButtonRemoveImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/remove-image.png")));
int index = ui->tabWidget->indexOf(ui->tabImages);
int const index = ui->tabWidget->indexOf(ui->tabImages);
if (index != -1)
{
ui->tabWidget->setTabIcon(index, VTheme::GetIconResource(iconResource, QStringLiteral("16x16/viewimage.png")));
}
QString tapeIconResource = QStringLiteral("tapeicon");
QString const tapeIconResource = QStringLiteral("tapeicon");
ui->actionMeasurementDiagram->setIcon(
VTheme::GetIconResource(tapeIconResource, QStringLiteral("24x24/mannequin.png")));
}
@ -2060,7 +2060,7 @@ void TKMMainWindow::InitIcons()
//---------------------------------------------------------------------------------------------------------------------
void TKMMainWindow::InitSearchHistory()
{
QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory();
QStringList const searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory();
m_searchHistory->clear();
if (searchHistory.isEmpty())
@ -2080,7 +2080,7 @@ void TKMMainWindow::InitSearchHistory()
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
QString const term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
@ -2093,7 +2093,7 @@ void TKMMainWindow::InitSearchHistory()
void TKMMainWindow::SaveSearchRequest()
{
QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetKMSearchHistory();
QString term = ui->lineEditFind->text();
QString const term = ui->lineEditFind->text();
if (term.isEmpty())
{
return;
@ -2120,7 +2120,7 @@ void TKMMainWindow::UpdateSearchControlsTooltips()
}
else if (m_serachButtonTooltips.contains(button))
{
QString tooltip = m_serachButtonTooltips.value(button);
QString const tooltip = m_serachButtonTooltips.value(button);
button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText)));
}
};
@ -2220,7 +2220,7 @@ void TKMMainWindow::RefreshImages()
{
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
int row = ui->listWidget->currentRow();
int const row = ui->listWidget->currentRow();
ui->listWidget->blockSignals(true);
ui->listWidget->clear();
@ -2229,7 +2229,7 @@ void TKMMainWindow::RefreshImages()
{
m_known = m_m->KnownMeasurements();
}
QMap<QUuid, VPatternImage> images = m_known.Images();
QMap<QUuid, VPatternImage> const images = m_known.Images();
int index = 1;
for (auto i = images.cbegin(), end = images.cend(); i != end; ++i)
@ -2244,13 +2244,14 @@ void TKMMainWindow::RefreshImages()
if (i.value().IsValid())
{
QSize size = i.value().Size();
QSize targetSize = ui->listWidget->iconSize();
QSize const size = i.value().Size();
QSize const targetSize = ui->listWidget->iconSize();
double scalingFactorWidth = static_cast<double>(targetSize.width()) / size.width();
double scalingFactorHeight = static_cast<double>(targetSize.height()) / size.height();
double const scalingFactorWidth = static_cast<double>(targetSize.width()) / size.width();
double const scalingFactorHeight = static_cast<double>(targetSize.height()) / size.height();
int newWidth, newHeight;
int newWidth;
int newHeight;
if (scalingFactorWidth < scalingFactorHeight)
{
@ -2267,11 +2268,11 @@ void TKMMainWindow::RefreshImages()
background.fill(Qt::transparent);
QPainter painter(&background);
QPixmap sourcePixmap = i.value().GetPixmap(newWidth, newHeight);
QPixmap const sourcePixmap = i.value().GetPixmap(newWidth, newHeight);
// Calculate the position to center the source pixmap in the transparent pixmap
int x = (background.width() - sourcePixmap.width()) / 2;
int y = background.height() - sourcePixmap.height();
int const x = (background.width() - sourcePixmap.width()) / 2;
int const y = background.height() - sourcePixmap.height();
painter.drawPixmap(x, y, sourcePixmap);
painter.end();
@ -2282,7 +2283,7 @@ void TKMMainWindow::RefreshImages()
{
QImageReader imageReader(QStringLiteral("://icon/svg/broken_path.svg"));
imageReader.setScaledSize(ui->listWidget->iconSize());
QImage image = imageReader.read();
QImage const image = imageReader.read();
item->setIcon(QPixmap::fromImage(image));
}
@ -2425,7 +2426,7 @@ void TKMMainWindow::ImageFields(bool enabled)
//---------------------------------------------------------------------------------------------------------------------
auto TKMMainWindow::GenerateMeasurementName() const -> QString
{
QHash<QString, VKnownMeasurement> m = m_known.Measurements();
QHash<QString, VKnownMeasurement> const m = m_known.Measurements();
qint32 num = 1;
QString name;
do
@ -2452,7 +2453,7 @@ void TKMMainWindow::InitMeasurementUnits()
ui->comboBoxMUnits->addItem(tr("Length units"), QVariant(static_cast<int>(MUnits::Table)));
ui->comboBoxMUnits->addItem(tr("Degrees"), QVariant(static_cast<int>(MUnits::Degrees)));
int i = ui->comboBoxMUnits->findData(current);
int const i = ui->comboBoxMUnits->findData(current);
if (i != -1)
{
ui->comboBoxMUnits->setCurrentIndex(i);
@ -2466,7 +2467,7 @@ void TKMMainWindow::InitMeasurementDiagramList()
{
ui->comboBoxDiagram->clear();
QMap<QUuid, VPatternImage> images = m_known.Images();
QMap<QUuid, VPatternImage> const images = m_known.Images();
ui->comboBoxDiagram->addItem(tr("None"), QUuid());
@ -2521,7 +2522,7 @@ auto TKMMainWindow::CheckMName(const QString &name, const QSet<QString> &importe
throw VException(tr("Imported file must not contain the same name twice."));
}
QRegularExpression rx(NameRegExp(VariableRegex::KnownMeasurement));
QRegularExpression const rx(NameRegExp(VariableRegex::KnownMeasurement));
if (not rx.match(name).hasMatch())
{
throw VException(tr("Measurement '%1' doesn't match regex pattern.").arg(name));

View File

@ -886,7 +886,7 @@ void TMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int
}
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
const QMap<int, QSharedPointer<VMeasurement>> orderedTable = OrderedMeasurements();
int row = 0;
@ -992,7 +992,7 @@ auto TMainWindow::FileSaveAs() -> bool
return false;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += '.'_L1 + suffix;
@ -1009,7 +1009,7 @@ auto TMainWindow::FileSaveAs() -> bool
if (QFileInfo::exists(fileName) && m_curFile != fileName)
{
// Temporary try to lock the file before saving
VLockGuard<char> tmp(fileName);
VLockGuard<char> const tmp(fileName);
if (not tmp.IsLocked())
{
qCCritical(tMainWindow, "%s",
@ -1025,7 +1025,7 @@ auto TMainWindow::FileSaveAs() -> bool
m_mIsReadOnly = false;
QString error;
bool result = SaveMeasurements(fileName, error);
bool const result = SaveMeasurements(fileName, error);
if (not result)
{
QMessageBox messageBox;
@ -1113,7 +1113,7 @@ void TMainWindow::ImportDataFromCSV()
return;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += '.'_L1 + suffix;
@ -1147,7 +1147,7 @@ void TMainWindow::ImportDataFromCSV()
if (columns->exec() == QDialog::Accepted)
{
QxtCsvModel csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(),
QxtCsvModel const csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(),
VTextCodec::codecForMib(dialog.GetSelectedMib()));
const QVector<int> map = columns->ColumnsMap();
@ -1254,7 +1254,7 @@ void TMainWindow::SaveNotes()
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SaveKnownMeasurements(int index)
{
QUuid known = ui->comboBoxKnownMeasurements->itemData(index).toUuid();
QUuid const known = ui->comboBoxKnownMeasurements->itemData(index).toUuid();
ui->actionEditCurrentKnownMeasurements->setEnabled(KnownMeasurementsRegistred(known));
@ -1502,7 +1502,7 @@ void TMainWindow::AddImage()
settings->SetPathCustomImage(QFileInfo(filePath).absolutePath());
}
VPatternImage image = VPatternImage::FromFile(filePath);
VPatternImage const image = VPatternImage::FromFile(filePath);
if (not image.IsValid())
{
@ -1589,17 +1589,17 @@ void TMainWindow::SaveImage()
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
QMimeType mime = image.MimeTypeFromData();
QMimeType const mime = image.MimeTypeFromData();
QString path = settings->GetPathCustomImage() + QDir::separator() + tr("untitled");
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
path += '.'_L1 + suffixes.at(0);
}
QString filter = mime.filterString();
QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
QString const filter = mime.filterString();
QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (not filename.isEmpty())
{
@ -1654,10 +1654,10 @@ void TMainWindow::ShowImage()
return;
}
QMimeType mime = image.MimeTypeFromData();
QMimeType const mime = image.MimeTypeFromData();
QString name = QDir::tempPath() + QDir::separator() + "image.XXXXXX"_L1;
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
name += '.'_L1 + suffixes.at(0);
@ -1710,7 +1710,7 @@ void TMainWindow::AddCustom()
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::AddKnown()
{
QScopedPointer<DialogMDataBase> dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this));
QScopedPointer<DialogMDataBase> const dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this));
if (dialog->exec() == QDialog::Rejected)
{
return;
@ -1719,11 +1719,11 @@ void TMainWindow::AddKnown()
vsizetype currentRow;
const QStringList list = dialog->GetNewNames();
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
auto AddMeasurement = [this, knownDB, &currentRow](const QString &name)
{
VKnownMeasurement known = knownDB.Measurement(name);
VKnownMeasurement const known = knownDB.Measurement(name);
if (m_mType == MeasurementsType::Individual)
{
@ -1809,7 +1809,7 @@ void TMainWindow::ImportFromPattern()
const QString filter(tr("Pattern files (*.val)"));
// Use standard path to individual measurements
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathPattern();
QString const pathTo = MApplication::VApp()->TapeSettings()->GetPathPattern();
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -1818,7 +1818,7 @@ void TMainWindow::ImportFromPattern()
return;
}
VLockGuard<char> tmp(mPath);
VLockGuard<char> const tmp(mPath);
if (not tmp.IsLocked())
{
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("This file already opened in another window.")));
@ -1829,7 +1829,7 @@ void TMainWindow::ImportFromPattern()
try
{
VPatternConverter converter(mPath);
QScopedPointer<VLitePattern> doc(new VLitePattern());
QScopedPointer<VLitePattern> const doc(new VLitePattern());
doc->setXMLContent(converter.Convert());
measurements = doc->ListMeasurements();
@ -2008,8 +2008,8 @@ void TMainWindow::ShowNewMData(bool fresh)
{
// Show known
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement known = knownDB.Measurement(meash->GetName());
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement const known = knownDB.Measurement(meash->GetName());
ui->plainTextEditDescription->setPlainText(known.description);
ui->lineEditFullName->setText(known.fullName);
@ -2111,8 +2111,8 @@ void TMainWindow::ShowNewMData(bool fresh)
ui->plainTextEditFormula->blockSignals(true);
QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
QString const formula = VTranslateVars::TryFormulaToUser(
meash->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormula->setPlainText(formula);
ui->plainTextEditFormula->blockSignals(false);
@ -2148,8 +2148,8 @@ void TMainWindow::ShowMDiagram(const QSharedPointer<VMeasurement> &m)
else
{
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement known = knownDB.Measurement(m->GetName());
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement const known = knownDB.Measurement(m->GetName());
image = knownDB.Image(known.diagram);
}
@ -2269,7 +2269,7 @@ void TMainWindow::SaveMValue()
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
QString text = ui->plainTextEditFormula->toPlainText();
QString const text = ui->plainTextEditFormula->toPlainText();
QTableWidgetItem *formulaField = ui->tableWidget->item(row, ColumnFormula);
if (formulaField->text() == text)
@ -2603,8 +2603,8 @@ void TMainWindow::ExportToIndividual()
dir = QFileInfo(m_curFile).absolutePath();
}
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
QString fName = tr("measurements.vit");
QString const filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
QString const fName = tr("measurements.vit");
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + '/'_L1 + fName, filters,
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
@ -2613,8 +2613,8 @@ void TMainWindow::ExportToIndividual()
return;
}
QString suffix = QStringLiteral("vit");
QFileInfo f(fileName);
QString const suffix = QStringLiteral("vit");
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += '.'_L1 + suffix;
@ -2625,7 +2625,7 @@ void TMainWindow::ExportToIndividual()
MApplication::VApp()->TapeSettings()->SetPathIndividualMeasurements(QFileInfo(fileName).absolutePath());
}
QScopedPointer<VContainer> tmpData(
QScopedPointer<VContainer> const tmpData(
new VContainer(VAbstractApplication::VApp()->TrVars(), &m_mUnit, VContainer::UniqueNamespace()));
VMeasurements individualMeasurements(m_mUnit, tmpData.data());
@ -2665,7 +2665,7 @@ void TMainWindow::RestrictFirstDimesion()
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
const QMap<QString, VDimensionRestriction> restrictions = m_m->GetRestrictions();
bool fullCircumference = m_m->IsFullCircumference();
bool const fullCircumference = m_m->IsFullCircumference();
DialogRestrictDimension dialog(dimensions, restrictions, RestrictDimension::First, fullCircumference, this);
if (dialog.exec() == QDialog::Rejected)
@ -2687,7 +2687,7 @@ void TMainWindow::RestrictSecondDimesion()
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
const QMap<QString, VDimensionRestriction> restrictions = m_m->GetRestrictions();
bool fullCircumference = m_m->IsFullCircumference();
bool const fullCircumference = m_m->IsFullCircumference();
DialogRestrictDimension dialog(dimensions, restrictions, RestrictDimension::Second, fullCircumference, this);
if (dialog.exec() == QDialog::Rejected)
@ -2705,7 +2705,7 @@ void TMainWindow::RestrictThirdDimesion()
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
const QMap<QString, VDimensionRestriction> restrictions = m_m->GetRestrictions();
bool fullCircumference = m_m->IsFullCircumference();
bool const fullCircumference = m_m->IsFullCircumference();
DialogRestrictDimension dialog(dimensions, restrictions, RestrictDimension::Third, fullCircumference, this);
if (dialog.exec() == QDialog::Rejected)
@ -2771,7 +2771,7 @@ void TMainWindow::AskDefaultSettings()
dialog.setWindowModality(Qt::WindowModal);
if (dialog.exec() == QDialog::Accepted)
{
QString locale = dialog.Locale();
QString const locale = dialog.Locale();
settings->SetLocale(locale);
VAbstractApplication::VApp()->LoadTranslation(locale);
}
@ -2902,7 +2902,7 @@ void TMainWindow::SetupMenu()
connect(ui->actionEditCurrentKnownMeasurements, &QAction::triggered, this,
[this]()
{
QUuid id = m_m->KnownMeasurements();
QUuid const id = m_m->KnownMeasurements();
if (id.isNull())
{
ui->actionEditCurrentKnownMeasurements->setDisabled(true);
@ -2910,7 +2910,7 @@ void TMainWindow::SetupMenu()
}
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
if (!known.contains(id))
{
qCritical() << tr("Unknown known measurements: %1").arg(id.toString());
@ -3183,7 +3183,7 @@ void TMainWindow::InitDimensionsBaseValue()
name->setText(dimension->Name() + ':'_L1);
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_m->IsFullCircumference()));
DimesionLabels labels = dimension->Labels();
DimesionLabels const labels = dimension->Labels();
if (VFuzzyContains(labels, dimension->BaseValue()) &&
not VFuzzyValue(labels, dimension->BaseValue()).isEmpty())
@ -3247,11 +3247,11 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
}
// Calculate the width of the largest item using QFontMetrics
QFontMetrics fontMetrics(control->font());
QFontMetrics const fontMetrics(control->font());
int maxWidth = 0;
for (int i = 0; i < control->count(); ++i)
{
int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
int const itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
if (itemWidth > maxWidth)
{
maxWidth = itemWidth;
@ -3265,7 +3265,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
// it invalid first
control->setCurrentIndex(-1);
int i = control->findData(current);
int const i = control->findData(current);
if (i != -1)
{
control->setCurrentIndex(i);
@ -3455,7 +3455,7 @@ auto TMainWindow::MaybeSave() -> bool
return true; // Don't ask if file was created without modifications.
}
QScopedPointer<QMessageBox> messageBox(
QScopedPointer<QMessageBox> const messageBox(
new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"),
tr("Measurements have been modified. Do you want to save your changes?"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet));
@ -3603,8 +3603,8 @@ void TMainWindow::RefreshTable(bool freshCall)
void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &meash, qint32 currentRow)
{
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement known = knownDB.Measurement(meash->GetName());
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement const known = knownDB.Measurement(meash->GetName());
if (m_mType == MeasurementsType::Individual)
{
@ -3633,8 +3633,8 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
meash->IsFormulaOk()); // calculated value
QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
QString const formula = VTranslateVars::TryFormulaToUser(
meash->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
AddCell(formula, currentRow, ColumnFormula, Qt::AlignVCenter); // formula
}
@ -3890,8 +3890,8 @@ void TMainWindow::SyncKnownMeasurements()
ShowMDiagram(meash);
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement known = knownDB.Measurement(meash->GetName());
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
VKnownMeasurement const known = knownDB.Measurement(meash->GetName());
ui->plainTextEditDescription->blockSignals(true);
ui->plainTextEditDescription->setPlainText(known.description);
@ -3941,7 +3941,7 @@ auto TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
{
f = formula;
}
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
qreal result = cal->EvalFormula(data->DataVariables(), f);
if (qIsInf(result) || qIsNaN(result))
@ -4139,7 +4139,7 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
throw VException(tr("File has unknown format."));
}
QScopedPointer<VAbstractMConverter> converter(
QScopedPointer<VAbstractMConverter> const converter(
(m_mType == MeasurementsType::Individual) ? static_cast<VAbstractMConverter *>(new VVITConverter(path))
: static_cast<VAbstractMConverter *>(new VVSTConverter(path)));
@ -4292,7 +4292,7 @@ auto TMainWindow::CheckMName(const QString &name, const QSet<QString> &importedN
throw VException(tr("Imported file must not contain the same name twice."));
}
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
if (not rx.match(name).hasMatch())
{
throw VException(tr("Measurement '%1' doesn't match regex pattern.").arg(name));
@ -4723,12 +4723,12 @@ auto TMainWindow::OrderedMeasurements() const -> QMap<int, QSharedPointer<VMeasu
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitIcons()
{
QString iconResource = QStringLiteral("icon");
QString const iconResource = QStringLiteral("icon");
ui->toolButtonExpr->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("24x24/fx.png")));
ui->toolButtonAddImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/insert-image.png")));
ui->toolButtonRemoveImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/remove-image.png")));
QString tapeIconResource = QStringLiteral("tapeicon");
QString const tapeIconResource = QStringLiteral("tapeicon");
ui->actionMeasurementDiagram->setIcon(
VTheme::GetIconResource(tapeIconResource, QStringLiteral("24x24/mannequin.png")));
}
@ -4770,12 +4770,12 @@ void TMainWindow::RetranslateMDiagram()
void TMainWindow::InitKnownMeasurements(QComboBox *combo)
{
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
SCASSERT(combo != nullptr)
combo->addItem(tr("None"), QUuid());
QUuid kmId = m_m->KnownMeasurements();
QUuid const kmId = m_m->KnownMeasurements();
if (!kmId.isNull() && !known.contains(kmId))
{
combo->addItem(tr("Invalid link"), kmId);
@ -4802,10 +4802,10 @@ void TMainWindow::InitKnownMeasurements(QComboBox *combo)
void TMainWindow::InitKnownMeasurementsDescription()
{
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
ui->plainTextEditKnownMeasurementsDescription->clear();
QUuid id = m_m->KnownMeasurements();
QUuid const id = m_m->KnownMeasurements();
if (!id.isNull() && known.contains(id))
{
ui->plainTextEditKnownMeasurementsDescription->setPlainText(known.value(id).description);
@ -4821,7 +4821,7 @@ auto TMainWindow::KnownMeasurementsRegistred(const QUuid &id) -> bool
}
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
return known.contains(id);
}
@ -4907,7 +4907,7 @@ void TMainWindow::ExportRowToCSV(QxtCsvModel &csv, int row, const QSharedPointer
{
csv.insertRow(row);
VKnownMeasurement known = knownDB.Measurement(meash->GetName());
VKnownMeasurement const known = knownDB.Measurement(meash->GetName());
csv.setText(row, 0, meash->GetName());
@ -4933,8 +4933,8 @@ void TMainWindow::ExportRowToCSV(QxtCsvModel &csv, int row, const QSharedPointer
if (m_mType == MeasurementsType::Individual)
{
QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
QString const formula = VTranslateVars::TryFormulaToUser(
meash->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
csv.setText(row, 3, formula);
if (meash->IsCustom())
@ -5103,7 +5103,7 @@ void TMainWindow::InitMeasurementUnits()
ui->comboBoxMUnits->addItem(units, QVariant(static_cast<int>(MUnits::Table)));
ui->comboBoxMUnits->addItem(tr("Degrees"), QVariant(static_cast<int>(MUnits::Degrees)));
int i = ui->comboBoxMUnits->findData(current);
int const i = ui->comboBoxMUnits->findData(current);
if (i != -1)
{
ui->comboBoxMUnits->setCurrentIndex(i);
@ -5140,7 +5140,7 @@ void TMainWindow::InitMeasurementDimension()
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::W), QVariant(static_cast<int>(IMD::W)));
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::Z), QVariant(static_cast<int>(IMD::Z)));
int i = ui->comboBoxDimension->findData(current);
int const i = ui->comboBoxDimension->findData(current);
if (i != -1)
{
ui->comboBoxDimension->setCurrentIndex(i);
@ -5280,7 +5280,7 @@ void TMainWindow::InitSearch()
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitSearchHistory()
{
QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory();
QStringList const searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory();
m_searchHistory->clear();
if (searchHistory.isEmpty())
@ -5300,7 +5300,7 @@ void TMainWindow::InitSearchHistory()
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
QString const term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
@ -5313,7 +5313,7 @@ void TMainWindow::InitSearchHistory()
void TMainWindow::SaveSearchRequest()
{
QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory();
QString term = ui->lineEditFind->text();
QString const term = ui->lineEditFind->text();
if (term.isEmpty())
{
return;
@ -5340,7 +5340,7 @@ void TMainWindow::UpdateSearchControlsTooltips()
}
else if (m_serachButtonTooltips.contains(button))
{
QString tooltip = m_serachButtonTooltips.value(button);
QString const tooltip = m_serachButtonTooltips.value(button);
button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText)));
}
};

View File

@ -108,7 +108,7 @@ auto AppFilePath(const QString &appName) -> QString
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
return AppImageRoot() + BINDIR + '/'_L1 + appName;
#else
QFileInfo canonicalFile(
QFileInfo const canonicalFile(
QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), appName + executableSuffix));
if (canonicalFile.exists())
{
@ -382,7 +382,7 @@ VApplication::~VApplication()
{
auto *statistic = VGAnalytics::Instance();
QString clientID = settings->GetClientID();
QString const clientID = settings->GetClientID();
if (!clientID.isEmpty())
{
statistic->SendAppCloseEvent(m_uptimeTimer.elapsed());
@ -562,7 +562,7 @@ auto VApplication::LogPath() -> QString
//---------------------------------------------------------------------------------------------------------------------
auto VApplication::CreateLogDir() -> bool
{
QDir logDir(LogDirPath());
QDir const logDir(LogDirPath());
if (not logDir.exists())
{
return logDir.mkpath(QChar('.')); // Create directory for log if need
@ -623,11 +623,11 @@ void VApplication::ClearOldLogs()
qCDebug(vApp, "Clearing old logs");
for (const auto &fn : allFiles)
{
QFileInfo info(fn);
QFileInfo const info(fn);
const QDateTime created = info.birthTime();
if (created.daysTo(QDateTime::currentDateTime()) >= DAYS_TO_KEEP_LOGS)
{
VLockGuard<QFile> tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); });
VLockGuard<QFile> const tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); });
if (tmp.GetProtected() != nullptr)
{
if (tmp.GetProtected()->remove())
@ -672,7 +672,7 @@ void VApplication::InitOptions()
QTimer::singleShot(0, this,
[]()
{
QString country = VGAnalytics::CountryCode();
QString const country = VGAnalytics::CountryCode();
if (country == "ru"_L1 || country == "by"_L1)
{
qFatal("country not detected");
@ -869,7 +869,7 @@ void VApplication::RepopulateMeasurementsDatabase(const QString &path)
Q_UNUSED(path)
if (m_knownMeasurementsDatabase != nullptr)
{
QFuture<void> future =
QFuture<void> const future =
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); });
}
}

View File

@ -114,7 +114,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
}
bool ok = false;
qreal height = Pg2Px(OptionValue(LONG_OPTION_PAGEH), diag, &ok);
qreal const height = Pg2Px(OptionValue(LONG_OPTION_PAGEH), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid page height value.") << "\n";
@ -123,7 +123,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
diag.SetPaperHeight(height);
ok = false;
qreal width = Pg2Px(OptionValue(LONG_OPTION_PAGEW), diag, &ok);
qreal const width = Pg2Px(OptionValue(LONG_OPTION_PAGEW), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid page width value.") << "\n";
@ -151,7 +151,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
if (IsOptionSet(LONG_OPTION_GAPWIDTH))
{
bool ok = false;
qreal width = Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag, &ok);
qreal const width = Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid gap width.") << "\n";
@ -472,7 +472,7 @@ auto VCommandLine::OptDimensionA() const -> int
const QString value = OptionValue(LONG_OPTION_DIMENSION_A);
bool ok = false;
int dimensionAValue = value.toInt(&ok);
int const dimensionAValue = value.toInt(&ok);
if (ok && dimensionAValue > 0)
{
return dimensionAValue;
@ -488,7 +488,7 @@ auto VCommandLine::OptDimensionB() const -> int
const QString value = OptionValue(LONG_OPTION_DIMENSION_B);
bool ok = false;
int dimensionBValue = value.toInt(&ok);
int const dimensionBValue = value.toInt(&ok);
if (ok && dimensionBValue > 0)
{
return dimensionBValue;
@ -504,7 +504,7 @@ auto VCommandLine::OptDimensionC() const -> int
const QString value = OptionValue(LONG_OPTION_DIMENSION_C);
bool ok = false;
int dimensionCValue = value.toInt(&ok);
int const dimensionCValue = value.toInt(&ok);
if (ok && dimensionCValue > 0)
{
return dimensionCValue;
@ -536,7 +536,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (IsOptionSet(LONG_OPTION_LEFT_MARGIN))
{
bool ok = false;
qreal margin = UnitConvertor(OptionValue(LONG_OPTION_LEFT_MARGIN).toDouble(&ok), unit, Unit::Mm);
qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_LEFT_MARGIN).toDouble(&ok), unit, Unit::Mm);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page left margin.") << "\n";
@ -548,7 +548,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (IsOptionSet(LONG_OPTION_RIGHT_MARGIN))
{
bool ok = false;
qreal margin = UnitConvertor(OptionValue(LONG_OPTION_RIGHT_MARGIN).toDouble(&ok), unit, Unit::Mm);
qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_RIGHT_MARGIN).toDouble(&ok), unit, Unit::Mm);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page right margin.") << "\n";
@ -560,7 +560,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (IsOptionSet(LONG_OPTION_TOP_MARGIN))
{
bool ok = false;
qreal margin = UnitConvertor(OptionValue(LONG_OPTION_TOP_MARGIN).toDouble(&ok), unit, Unit::Mm);
qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_TOP_MARGIN).toDouble(&ok), unit, Unit::Mm);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page top margin.") << "\n";
@ -572,7 +572,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (IsOptionSet(LONG_OPTION_BOTTOM_MARGIN))
{
bool ok = false;
qreal margin = UnitConvertor(OptionValue(LONG_OPTION_BOTTOM_MARGIN).toDouble(&ok), unit, Unit::Mm);
qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_BOTTOM_MARGIN).toDouble(&ok), unit, Unit::Mm);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page bottom margin.") << "\n";
@ -865,11 +865,11 @@ auto VCommandLine::OptEfficiencyCoefficient() const -> qreal
//---------------------------------------------------------------------------------------------------------------------
void VCommandLine::TestPageformat() const
{
bool x = IsOptionSet(LONG_OPTION_PAGETEMPLATE);
bool const x = IsOptionSet(LONG_OPTION_PAGETEMPLATE);
bool a = IsOptionSet(LONG_OPTION_PAGEH);
bool b = IsOptionSet(LONG_OPTION_PAGEW);
bool c = IsOptionSet(LONG_OPTION_PAGEUNITS);
bool const a = IsOptionSet(LONG_OPTION_PAGEH);
bool const b = IsOptionSet(LONG_OPTION_PAGEW);
bool const c = IsOptionSet(LONG_OPTION_PAGEUNITS);
if ((a || b) && x)
{
@ -887,8 +887,8 @@ void VCommandLine::TestPageformat() const
//---------------------------------------------------------------------------------------------------------------------
void VCommandLine::TestGapWidth() const
{
bool a = IsOptionSet(LONG_OPTION_GAPWIDTH);
bool b = IsOptionSet(LONG_OPTION_SHIFTUNITS);
bool const a = IsOptionSet(LONG_OPTION_GAPWIDTH);
bool const b = IsOptionSet(LONG_OPTION_SHIFTUNITS);
if ((a || b) && !(a && b))
{
@ -902,8 +902,8 @@ void VCommandLine::TestMargins() const
{
auto CheckKey = [this](const QString &key, const QString &message)
{
bool a = IsOptionSet(key);
bool b = IsOptionSet(LONG_OPTION_PAGEUNITS);
bool const a = IsOptionSet(key);
bool const b = IsOptionSet(LONG_OPTION_PAGEUNITS);
if (a && !(a && b))
{
@ -945,7 +945,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (IsOptionSet(LONG_OPTION_LEFT_MARGIN))
{
bool ok = false;
qreal margin = Pg2Px(OptionValue(LONG_OPTION_LEFT_MARGIN), diag, &ok);
qreal const margin = Pg2Px(OptionValue(LONG_OPTION_LEFT_MARGIN), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page left margin.") << "\n";
@ -957,7 +957,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (IsOptionSet(LONG_OPTION_RIGHT_MARGIN))
{
bool ok = false;
qreal margin = Pg2Px(OptionValue(LONG_OPTION_RIGHT_MARGIN), diag, &ok);
qreal const margin = Pg2Px(OptionValue(LONG_OPTION_RIGHT_MARGIN), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page right margin.") << "\n";
@ -969,7 +969,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (IsOptionSet(LONG_OPTION_TOP_MARGIN))
{
bool ok = false;
qreal margin = Pg2Px(OptionValue(LONG_OPTION_TOP_MARGIN), diag, &ok);
qreal const margin = Pg2Px(OptionValue(LONG_OPTION_TOP_MARGIN), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page top margin.") << "\n";
@ -981,7 +981,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (IsOptionSet(LONG_OPTION_BOTTOM_MARGIN))
{
bool ok = false;
qreal margin = Pg2Px(OptionValue(LONG_OPTION_BOTTOM_MARGIN), diag, &ok);
qreal const margin = Pg2Px(OptionValue(LONG_OPTION_BOTTOM_MARGIN), diag, &ok);
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page bottom margin.") << "\n";

View File

@ -166,7 +166,7 @@ void VFormulaProperty::setValue(const QVariant &value)
//---------------------------------------------------------------------------------------------------------------------
auto VFormulaProperty::getValue() const -> QVariant
{
VFormula tmpFormula = GetFormula();
VFormula const tmpFormula = GetFormula();
QVariant value;
value.setValue(tmpFormula);
return value;

View File

@ -89,7 +89,7 @@ void VFormulaPropertyEditor::SetFormula(const VFormula &formula)
//---------------------------------------------------------------------------------------------------------------------
void VFormulaPropertyEditor::onToolButtonClicked()
{
QScopedPointer<DialogEditWrongFormula> tmpWidget(new DialogEditWrongFormula(
QScopedPointer<DialogEditWrongFormula> const tmpWidget(new DialogEditWrongFormula(
m_formula.getData(), m_formula.getToolId(), VAbstractValApplication::VApp()->getMainWindow()));
tmpWidget->setCheckZero(m_formula.getCheckZero());
tmpWidget->setPostfix(m_formula.getPostfix());

View File

@ -807,7 +807,7 @@ void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &p
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::AddPropertyOpacity(const QString &propertyName, int opacity)
{
QMap<QString, QVariant> settings{{QStringLiteral("Min"), 0},
QMap<QString, QVariant> const settings{{QStringLiteral("Min"), 0},
{QStringLiteral("Max"), 100},
{QStringLiteral("Step"), 1},
{QStringLiteral("Suffix"), QChar('%')}};
@ -822,7 +822,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetName(VPE::VProperty *
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (name == i->name())
{
return;
@ -841,7 +841,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetHold(VPE::VProperty *
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
bool hold = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool();
bool const hold = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool();
if (hold == i->IsHold())
{
return;
@ -860,7 +860,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetVisible(VPE::VPropert
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
bool visible = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool();
bool const visible = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool();
if (visible == i->IsVisible())
{
return;
@ -898,13 +898,13 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetPointName(VPE::VPrope
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (name == i->name())
{
return;
}
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
if (name.isEmpty() || not VContainer::IsUnique(name, valentinaNamespace) || not rx.match(name).hasMatch())
{
m_idToProperty[AttrName]->setValue(i->name());
@ -925,13 +925,13 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetPointName1(VPE::VProp
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (name == i->nameP1())
{
return;
}
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
if (name.isEmpty() || not VContainer::IsUnique(name, valentinaNamespace) || not rx.match(name).hasMatch())
{
m_idToProperty[AttrName1]->setValue(i->nameP1());
@ -952,13 +952,13 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetPointName2(VPE::VProp
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (name == i->nameP2())
{
return;
}
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
if (name.isEmpty() || not VContainer::IsUnique(name, valentinaNamespace) || not rx.match(name).hasMatch())
{
m_idToProperty[AttrName2]->setValue(i->nameP2());
@ -979,7 +979,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE::
{
if (auto *item = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString suffix = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const suffix = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (suffix == item->Suffix())
{
@ -992,7 +992,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE::
return;
}
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
const QStringList uniqueNames = VContainer::AllUniqueNames(valentinaNamespace);
for (const auto &uniqueName : uniqueNames)
{
@ -1114,7 +1114,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetNotes(VPE::VProperty
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (notes == i->GetNotes())
{
return;
@ -1133,7 +1133,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (notes == i->GetAliasSuffix())
{
return;
@ -1152,7 +1152,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetAlias1(VPE::VProperty
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (notes == i->GetAliasSuffix1())
{
return;
@ -1171,7 +1171,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetAlias2(VPE::VProperty
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (notes == i->GetAliasSuffix2())
{
return;
@ -1190,7 +1190,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetLineType(VPE::VProper
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString type = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const type = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (type == i->getLineType())
{
return;
@ -1209,7 +1209,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetLineColor(VPE::VPrope
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString color = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const color = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (color == i->GetLineColor())
{
return;
@ -1323,7 +1323,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetPenStyle(VPE::VProper
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
QString pen = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
QString const pen = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (pen == i->GetPenStyle())
{
return;
@ -1361,7 +1361,7 @@ template <class Tool> void VToolOptionsPropertyBrowser::SetApproximationScale(VP
{
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
{
double scale = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble();
double const scale = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble();
if (VFuzzyComparePossibleNulls(scale, i->GetApproximationScale()))
{
return;
@ -1394,7 +1394,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VPE::VProperty *prop
{
if (auto *i = qgraphicsitem_cast<VToolBasePoint *>(m_currentItem))
{
QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
i->SetBasePointPos(value.toPointF());
}
else
@ -1831,7 +1831,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolNormal(VPE::VProperty *property)
{
if (auto *i = qgraphicsitem_cast<VToolNormal *>(m_currentItem))
{
double value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble();
double const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble();
if (VFuzzyComparePossibleNulls(value, i->GetAngle()))
{
return;
@ -2183,7 +2183,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
{
SCASSERT(property != nullptr)
QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = m_propertyToId[property];
auto *i = qgraphicsitem_cast<VToolSpline *>(m_currentItem);
@ -2318,7 +2318,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VPE::VProperty *prope
auto *i = qgraphicsitem_cast<VToolSplinePath *>(m_currentItem);
SCASSERT(i != nullptr)
QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
VSplinePath spl = i->getSplinePath();
spl.SetApproximationScale(value.toDouble());
i->setSplinePath(spl);
@ -2359,7 +2359,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VPE::VProperty *
auto *i = qgraphicsitem_cast<VToolCubicBezierPath *>(m_currentItem);
SCASSERT(i != nullptr)
QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
VCubicBezierPath spl = i->getSplinePath();
spl.SetApproximationScale(value.toDouble());
i->setSplinePath(spl);
@ -2741,7 +2741,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolEndLine(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Point at distance and angle"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("Base point:"), AttrBasePoint);
@ -2760,7 +2760,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolAlongLine(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Point at distance along line"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint);
@ -2779,7 +2779,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Arc"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyParentPointName(i->CenterPointName(), tr("Center point:"), AttrCenter);
@ -2802,7 +2802,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArcWithLength(QGraphicsItem *it
i->ShowVisualization(true);
m_formView->setTitle(tr("Arc with given length"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyParentPointName(i->CenterPointName(), tr("Center point:"), AttrCenter);
@ -2825,7 +2825,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolBisector(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Point along bisector"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrFirstPoint);
@ -2907,7 +2907,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolHeight(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Perpendicular point along line"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("Base point:"), AttrBasePoint);
@ -2926,7 +2926,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLine(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Line between points"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrFirstPoint);
AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrSecondPoint);
@ -2960,7 +2960,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Point along perpendicular"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
AddPropertyObjectName(i, tr("Point label:"));
@ -3089,7 +3089,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *it
i->ShowVisualization(true);
m_formView->setTitle(tr("Special point on shoulder"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint);
@ -3137,7 +3137,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
length2.Eval();
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyAlias(i, tr("Alias:"));
AddPropertyCurvePenStyle(
@ -3155,7 +3155,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezier(QGraphicsItem *item
i->ShowVisualization(true);
m_formView->setTitle(tr("Cubic bezier curve"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrPoint1);
@ -3178,7 +3178,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item)
i->ShowVisualization(true);
m_formView->setTitle(tr("Tool for path curve"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyAlias(i, tr("Alias:"));
@ -3197,7 +3197,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezierPath(QGraphicsItem *
i->ShowVisualization(true);
m_formView->setTitle(tr("Tool cubic bezier curve"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyAlias(i, tr("Alias:"));
@ -3231,7 +3231,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLineIntersectAxis(QGraphicsItem
i->ShowVisualization(true);
m_formView->setTitle(tr("Point intersection line and axis"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("Axis point:"), AttrBasePoint);
@ -3251,7 +3251,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCurveIntersectAxis(QGraphicsIte
i->ShowVisualization(true);
m_formView->setTitle(tr("Point intersection curve and axis"));
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("Axis point:"), AttrBasePoint);
@ -3377,7 +3377,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -3411,7 +3411,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -3458,7 +3458,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
m_idToProperty[AttrAngle2]->setValue(valueSecondAngle);
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->GetPenStyle());
@ -3503,7 +3503,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength()
m_idToProperty[AttrLength]->setValue(valueLength);
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->GetPenStyle());
@ -3540,7 +3540,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector()
m_idToProperty[AttrLength]->setValue(valueFormula);
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -3669,7 +3669,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -3702,7 +3702,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLine()
auto *i = qgraphicsitem_cast<VToolLine *>(m_currentItem);
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -3765,7 +3765,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal()
m_idToProperty[AttrAngle]->setValue(i->GetAngle());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -3952,7 +3952,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -4020,7 +4020,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
m_idToProperty[AttrLength2]->setValue(length2);
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->GetPenStyle());
@ -4047,7 +4047,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->GetPenStyle());
@ -4090,7 +4090,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->GetPenStyle());
@ -4117,7 +4117,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->GetPenStyle());
@ -4169,7 +4169,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -4207,7 +4207,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis()
m_idToProperty[AttrName]->setValue(i->name());
{
QPalette comboBoxPalette = ComboBoxPalette();
QPalette const comboBoxPalette = ComboBoxPalette();
const auto index = VPE::VLineTypeProperty::IndexOfStyle(
LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)),
i->getLineType());
@ -4375,7 +4375,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsBackgroundSVGItem()
//---------------------------------------------------------------------------------------------------------------------
auto VToolOptionsPropertyBrowser::PropertiesList() -> QStringList
{
static QStringList attr{
static QStringList const attr{
AttrName, /* 0 */
"position"_L1, /* 1 */
AttrBasePoint, /* 2 */

View File

@ -139,7 +139,7 @@ void PreferencesPathPage::EditPath()
}
bool usedNotExistedDir = false;
QDir directory(path);
QDir const directory(path);
if (not directory.exists())
{
usedNotExistedDir = directory.mkpath(QChar('.'));

View File

@ -134,7 +134,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
ui->checkBoxHideMainPath->setChecked(settings->IsHideMainPath());
QFont labelFont = settings->GetLabelFont();
int pointSize = settings->GetPieceLabelFontPointSize();
int const pointSize = settings->GetPieceLabelFontPointSize();
labelFont.setPointSize(qMax(pointSize, 1));
ui->fontComboBoxLabelFont->setCurrentFont(labelFont);
@ -268,7 +268,7 @@ void PreferencesPatternPage::changeEvent(QEvent *event)
if (event->type() == QEvent::PaletteChange)
{
QString currentSingleLineFont = ui->comboBoxSingleLineFont->currentData().toString();
QString const currentSingleLineFont = ui->comboBoxSingleLineFont->currentData().toString();
InitSingleLineFonts();
const qint32 indexFont = ui->comboBoxSingleLineFont->findData(currentSingleLineFont);
if (indexFont != -1)
@ -353,8 +353,8 @@ void PreferencesPatternPage::InitSingleLineFonts()
const qreal dpiY = primaryScreen->physicalDotsPerInchY();
const qreal scale = primaryScreen->devicePixelRatio();
int previewWidth = 250;
int previewHeight = QFontMetrics(QGuiApplication::font()).height();
int const previewWidth = 250;
int const previewHeight = QFontMetrics(QGuiApplication::font()).height();
// Calculate the desired image size in physical pixels
const int desiredWidthInPixels = qRound(previewWidth * dpiX / 96.0);
@ -379,7 +379,7 @@ void PreferencesPatternPage::InitSingleLineFonts()
{
VSvgFontEngine engine = db->FontEngine(family, SVGFontStyle::Normal, SVGFontWeight::Normal);
VSvgFont svgFont = engine.Font();
VSvgFont const svgFont = engine.Font();
if (!svgFont.IsValid())
{
continue;
@ -412,7 +412,7 @@ void PreferencesPatternPage::InitComboBoxFormats(QComboBox *box, const QStringLi
SCASSERT(box != nullptr)
box->addItems(items);
int index = box->findText(currentFormat);
int const index = box->findText(currentFormat);
if (index != -1)
{
box->setCurrentIndex(index);
@ -456,7 +456,7 @@ void PreferencesPatternPage::CallDateTimeFormatEditor(const T &type, const QStri
box->clear();
box->addItems(dialog.GetFormats());
int index = box->findText(currentFormat);
int const index = box->findText(currentFormat);
if (index != -1)
{
box->setCurrentIndex(index);

View File

@ -56,7 +56,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent)
ui->labelBuildRevision->setText(QStringLiteral("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
ui->label_QT_Version->setText(buildCompatibilityString());
QDate date = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), QStringLiteral("MMM d yyyy"));
QDate const date = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), QStringLiteral("MMM d yyyy"));
ui->label_Valentina_Built->setText(tr("Built on %1 at %2").arg(date.toString(), QStringLiteral(__TIME__)));
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",

View File

@ -388,7 +388,7 @@ void DialogFinalMeasurements::SaveFormula()
}
// Replace line return character with spaces for calc if exist
QString text = ui->plainTextEditFormula->toPlainText();
QString const text = ui->plainTextEditFormula->toPlainText();
QTableWidgetItem *formulaField = ui->tableWidget->item(row, 2);
if (formulaField->text() == text)
@ -472,7 +472,7 @@ void DialogFinalMeasurements::Fx()
return;
}
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this));
QScopedPointer<DialogEditWrongFormula> const dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this));
dialog->setWindowTitle(tr("Edit measurement"));
dialog->SetFormula(VTranslateVars::TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
@ -610,7 +610,7 @@ auto DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
{
f = formula;
}
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
const qreal result = cal->EvalFormula(m_data.DataVariables(), f);
if (qIsInf(result) || qIsNaN(result))
@ -708,7 +708,7 @@ void DialogFinalMeasurements::EnableDetails(bool enabled)
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::UpdateTree()
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
FillFinalMeasurements();
ui->tableWidget->blockSignals(true);
ui->tableWidget->selectRow(row);
@ -730,7 +730,7 @@ auto DialogFinalMeasurements::EvalFormula(const QString &formula, bool &ok) -> q
try
{
// Replace line return character with spaces for calc if exist
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
result = cal->EvalFormula(m_data.DataVariables(), formula);
if (qIsInf(result) || qIsNaN(result))
@ -882,7 +882,7 @@ void DialogFinalMeasurements::InitSearch()
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::InitSearchHistory()
{
QStringList searchHistory =
QStringList const searchHistory =
VAbstractValApplication::VApp()->ValentinaSettings()->GetFinalMeasurementsSearchHistory();
m_searchHistory->clear();
@ -903,7 +903,7 @@ void DialogFinalMeasurements::InitSearchHistory()
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
QString const term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
@ -917,7 +917,7 @@ void DialogFinalMeasurements::SaveSearchRequest()
{
QStringList searchHistory =
VAbstractValApplication::VApp()->ValentinaSettings()->GetFinalMeasurementsSearchHistory();
QString term = ui->lineEditFind->text();
QString const term = ui->lineEditFind->text();
if (term.isEmpty())
{
return;
@ -944,7 +944,7 @@ void DialogFinalMeasurements::UpdateSearchControlsTooltips()
}
else if (m_serachButtonTooltips.contains(button))
{
QString tooltip = m_serachButtonTooltips.value(button);
QString const tooltip = m_serachButtonTooltips.value(button);
button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText)));
}
};
@ -961,7 +961,7 @@ void DialogFinalMeasurements::UpdateSearchControlsTooltips()
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::InitIcons()
{
QString resource = QStringLiteral("icon");
QString const resource = QStringLiteral("icon");
ui->toolButtonExpr->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png")));
}

View File

@ -202,15 +202,15 @@ void DialogHistory::UpdateHistory()
void DialogHistory::FillTable()
{
ui->tableWidget->clear();
QVector<VToolRecord> history = m_doc->getLocalHistory();
QVector<VToolRecord> const history = m_doc->getLocalHistory();
qint32 currentRow = -1;
qint32 count = 0;
ui->tableWidget->setRowCount(static_cast<int>(history.size())); // Make row count max possible number
std::function<HistoryRecord(const VToolRecord &tool)> CreateRecord = [this](const VToolRecord &tool)
std::function<HistoryRecord(const VToolRecord &tool)> const CreateRecord = [this](const VToolRecord &tool)
{ return Record(tool); };
QVector<HistoryRecord> historyRecords = QtConcurrent::blockingMapped(history, CreateRecord);
QVector<HistoryRecord> const historyRecords = QtConcurrent::blockingMapped(history, CreateRecord);
for (auto &record : historyRecords)
{
@ -259,7 +259,7 @@ auto DialogHistory::Record(const VToolRecord &tool) const -> HistoryRecord
HistoryRecord record;
record.id = tool.getId();
bool updateCache = false;
bool const updateCache = false;
const QDomElement domElem = m_doc->elementById(tool.getId(), QString(), updateCache);
if (not domElem.isElement())
{
@ -599,7 +599,7 @@ void DialogHistory::UpdateShortcuts()
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::RetranslateUi()
{
qint32 currentRow = m_cursorRow;
qint32 const currentRow = m_cursorRow;
UpdateHistory();
QTableWidgetItem *item = ui->tableWidget->item(m_cursorRow, 0);
@ -766,7 +766,7 @@ void DialogHistory::InitSearch()
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::InitSearchHistory()
{
QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory();
QStringList const searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory();
m_searchHistory->clear();
if (searchHistory.isEmpty())
@ -786,7 +786,7 @@ void DialogHistory::InitSearchHistory()
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
QString const term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
@ -799,7 +799,7 @@ void DialogHistory::InitSearchHistory()
void DialogHistory::SaveSearchRequest()
{
QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory();
QString term = ui->lineEditFind->text();
QString const term = ui->lineEditFind->text();
if (term.isEmpty())
{
return;
@ -826,7 +826,7 @@ void DialogHistory::UpdateSearchControlsTooltips()
}
else if (m_serachButtonTooltips.contains(button))
{
QString tooltip = m_serachButtonTooltips.value(button);
QString const tooltip = m_serachButtonTooltips.value(button);
button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText)));
}
};

View File

@ -231,7 +231,7 @@ template <typename T> void DialogIncrements::FillTable(const QMap<QString, T> &v
while (i.hasNext())
{
i.next();
qreal length = *i.value()->GetValue();
qreal const length = *i.value()->GetValue();
currentRow++;
table->setRowCount(static_cast<int>(varTable.size()));
@ -421,7 +421,7 @@ auto DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
{
f = formula;
}
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
const qreal result = cal->EvalFormula(data->DataVariables(), f);
if (qIsInf(result) || qIsNaN(result))
@ -627,7 +627,7 @@ void DialogIncrements::EnableDetails(QTableWidget *table, bool enabled)
{
const QTableWidgetItem *nameField = table->item(table->currentRow(), 0);
SCASSERT(nameField != nullptr)
QSharedPointer<VIncrement> incr = m_data->GetVariable<VIncrement>(nameField->text());
QSharedPointer<VIncrement> const incr = m_data->GetVariable<VIncrement>(nameField->text());
const bool isSeparator = incr->GetIncrementType() == IncrementType::Separator;
if (table == ui->tableWidgetIncrement)
@ -696,7 +696,7 @@ auto DialogIncrements::IncrementUsed(const QString &name) const -> bool
// Eval formula
try
{
QScopedPointer<qmu::QmuTokenParser> cal(
QScopedPointer<qmu::QmuTokenParser> const cal(
new qmu::QmuTokenParser(field.expression, false, false));
// Tokens (variables, measurements)
@ -793,8 +793,8 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table)
EvalIncrementFormula(incr->GetFormula(), false, incr->GetData(), labelCalculatedValue, incr->IsSpecialUnits());
plainTextEditFormula->blockSignals(true);
QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(),
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
QString const formula = VTranslateVars::TryFormulaToUser(
incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
plainTextEditFormula->setPlainText(formula);
plainTextEditFormula->blockSignals(false);
@ -1126,7 +1126,8 @@ void DialogIncrements::InitSearch()
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::InitIncrementsSearchHistory()
{
QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetIncrementsSearchHistory();
QStringList const searchHistory =
VAbstractValApplication::VApp()->ValentinaSettings()->GetIncrementsSearchHistory();
m_searchHistory->clear();
if (searchHistory.isEmpty())
@ -1146,7 +1147,7 @@ void DialogIncrements::InitIncrementsSearchHistory()
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
QString const term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
@ -1158,7 +1159,7 @@ void DialogIncrements::InitIncrementsSearchHistory()
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::InitPreviewCalculationsSearchHistory()
{
QStringList searchHistory =
QStringList const searchHistory =
VAbstractValApplication::VApp()->ValentinaSettings()->GetPreviewCalculationsSearchHistory();
m_searchHistoryPC->clear();
@ -1179,7 +1180,7 @@ void DialogIncrements::InitPreviewCalculationsSearchHistory()
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
QString const term = action->data().toString();
ui->lineEditFindPC->setText(term);
m_searchPC->Find(term);
ui->lineEditFindPC->setFocus();
@ -1192,7 +1193,7 @@ void DialogIncrements::InitPreviewCalculationsSearchHistory()
void DialogIncrements::SaveIncrementsSearchRequest()
{
QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetIncrementsSearchHistory();
QString term = ui->lineEditFind->text();
QString const term = ui->lineEditFind->text();
if (term.isEmpty())
{
return;
@ -1212,7 +1213,7 @@ void DialogIncrements::SavePreviewCalculationsSearchRequest()
{
QStringList searchHistory =
VAbstractValApplication::VApp()->ValentinaSettings()->GetPreviewCalculationsSearchHistory();
QString term = ui->lineEditFindPC->text();
QString const term = ui->lineEditFindPC->text();
if (term.isEmpty())
{
return;
@ -1239,7 +1240,7 @@ void DialogIncrements::UpdateSearchControlsTooltips()
}
else if (m_serachButtonTooltips.contains(button))
{
QString tooltip = m_serachButtonTooltips.value(button);
QString const tooltip = m_serachButtonTooltips.value(button);
button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText)));
}
};
@ -1295,7 +1296,7 @@ void DialogIncrements::InitIncrementUnits(QComboBox *combo)
combo->addItem(units, QVariant(static_cast<int>(IncrUnits::Pattern)));
combo->addItem(tr("Degrees"), QVariant(static_cast<int>(IncrUnits::Degrees)));
int i = combo->findData(current);
int const i = combo->findData(current);
if (i != -1)
{
combo->setCurrentIndex(i);
@ -1430,7 +1431,7 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
}
AddCell(table, calculatedValue, currentRow, 1, Qt::AlignCenter, incr->IsFormulaOk()); // calculated value
QString formula = VTranslateVars::TryFormulaToUser(
QString const formula = VTranslateVars::TryFormulaToUser(
incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula
@ -1783,8 +1784,8 @@ void DialogIncrements::SaveIncrFormula()
const QTableWidgetItem *nameField = table->item(row, 0);
QString text = textEdit->toPlainText();
QSharedPointer<VIncrement> incr = m_data->GetVariable<VIncrement>(nameField->text());
QString const text = textEdit->toPlainText();
QSharedPointer<VIncrement> const incr = m_data->GetVariable<VIncrement>(nameField->text());
QTableWidgetItem *formulaField = table->item(row, 2);
if (formulaField->text() == text)
@ -1941,9 +1942,9 @@ void DialogIncrements::Fx()
}
const QTableWidgetItem *nameField = table->item(row, 0);
QSharedPointer<VIncrement> incr = m_data->GetVariable<VIncrement>(nameField->text());
QSharedPointer<VIncrement> const incr = m_data->GetVariable<VIncrement>(nameField->text());
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(incr->GetData(), NULL_ID, this));
QScopedPointer<DialogEditWrongFormula> const dialog(new DialogEditWrongFormula(incr->GetData(), NULL_ID, this));
dialog->setWindowTitle(tr("Edit increment"));
incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode();

View File

@ -519,7 +519,7 @@ void DialogLayoutSettings::ConvertPaperSize()
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::SelectPaperUnit(const QString &units) -> bool
{
qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(units);
qint32 const indexUnit = ui->comboBoxPaperSizeUnit->findData(units);
if (indexUnit != -1)
{
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
@ -530,7 +530,7 @@ auto DialogLayoutSettings::SelectPaperUnit(const QString &units) -> bool
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::SelectLayoutUnit(const QString &units) -> bool
{
qint32 indexUnit = ui->comboBoxLayoutUnit->findData(units);
qint32 const indexUnit = ui->comboBoxLayoutUnit->findData(units);
if (indexUnit != -1)
{
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
@ -632,7 +632,7 @@ void DialogLayoutSettings::PaperSizeChanged()
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::SelectTemplate(const PaperSizeTemplate &id) -> bool
{
int index = ui->comboBoxTemplates->findData(static_cast<VIndexType>(id));
int const index = ui->comboBoxTemplates->findData(static_cast<VIndexType>(id));
if (index > -1)
{
ui->comboBoxTemplates->setCurrentIndex(index);
@ -689,7 +689,7 @@ void DialogLayoutSettings::DialogAccepted()
}
else
{
QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (printer.isNull())
{
m_generator->SetPrinterFields(true, GetFields());
@ -764,7 +764,7 @@ void DialogLayoutSettings::RestoreDefaults()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::PrinterMargins()
{
QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (not printer.isNull())
{
SetFields(GetPrinterFields(QSharedPointer<QPrinter>(new QPrinter(printer))));
@ -958,7 +958,7 @@ auto DialogLayoutSettings::GetTemplateSize(const PaperSizeTemplate &tmpl, const
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::MinPrinterFields() const -> QMarginsF
{
QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (not printer.isNull())
{
return GetMinPrinterFields(QSharedPointer<QPrinter>(new QPrinter(printer)));
@ -970,7 +970,7 @@ auto DialogLayoutSettings::MinPrinterFields() const -> QMarginsF
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::GetDefPrinterFields() const -> QMarginsF
{
QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (not printer.isNull())
{
return GetPrinterFields(QSharedPointer<QPrinter>(new QPrinter(printer)));

View File

@ -101,7 +101,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *patt
ui->comboBoxLabelLanguage->addItem(QLocale(name).nativeLanguageName(), name);
}
int index =
int const index =
ui->comboBoxLabelLanguage->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
if (index != -1)
{
@ -329,7 +329,7 @@ void DialogPatternProperties::ValidatePassmarkLength() const
QPalette palette = ui->lineEditPassmarkLength->palette();
const QPalette::ColorRole foregroundRole = ui->lineEditPassmarkLength->foregroundRole();
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
if (not text.isEmpty())
{
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text)
@ -351,7 +351,7 @@ void DialogPatternProperties::ValidatePassmarkWidth() const
QPalette palette = ui->lineEditPassmarkWidth->palette();
const QPalette::ColorRole foregroundRole = ui->lineEditPassmarkWidth->foregroundRole();
QRegularExpression rx(NameRegExp());
QRegularExpression const rx(NameRegExp());
if (not text.isEmpty())
{
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text)
@ -405,7 +405,7 @@ void DialogPatternProperties::InitImage()
const VPatternImage image = m_doc->GetImage();
if (image.IsValid())
{
QPixmap pixImage = image.GetPixmap();
QPixmap const pixImage = image.GetPixmap();
ui->imageLabel->setPixmap(
pixImage.scaled(ui->imageLabel->width(), ui->imageLabel->height(), Qt::KeepAspectRatio));
}
@ -432,7 +432,7 @@ void DialogPatternProperties::ChangeImage()
settings->SetPathCustomImage(QFileInfo(fileName).absolutePath());
}
VPatternImage image = VPatternImage::FromFile(fileName);
VPatternImage const image = VPatternImage::FromFile(fileName);
if (not image.IsValid())
{
@ -442,7 +442,7 @@ void DialogPatternProperties::ChangeImage()
m_doc->SetImage(image);
QPixmap pixImage = image.GetPixmap();
QPixmap const pixImage = image.GetPixmap();
ui->imageLabel->setPixmap(
pixImage.scaled(ui->imageLabel->width(), ui->imageLabel->height(), Qt::KeepAspectRatio));
@ -465,17 +465,17 @@ void DialogPatternProperties::SaveImage()
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
QMimeType mime = image.MimeTypeFromData();
QMimeType const mime = image.MimeTypeFromData();
QString path = settings->GetPathCustomImage() + QDir::separator() + tr("untitled");
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
path += '.'_L1 + suffixes.at(0);
}
QString filter = mime.filterString();
QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
QString const filter = mime.filterString();
QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (not filename.isEmpty())
{
@ -507,10 +507,10 @@ void DialogPatternProperties::ShowImage()
return;
}
QMimeType mime = image.MimeTypeFromData();
QMimeType const mime = image.MimeTypeFromData();
QString name = QDir::tempPath() + QDir::separator() + QStringLiteral("image.XXXXXX");
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
name += '.'_L1 + suffixes.at(0);
@ -541,7 +541,7 @@ void DialogPatternProperties::BrowseLabelPath()
path = settings->GetPathLabelTemplate();
}
QString filters(tr("Label template") + "(*.xml)"_L1);
QString const filters(tr("Label template") + "(*.xml)"_L1);
const QString filePath = QFileDialog::getOpenFileName(this, tr("Label template"), path, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());

View File

@ -93,7 +93,7 @@ void DialogPreferences::showEvent(QShowEvent *event)
}
// do your init stuff here
QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
QSize const sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@ -140,7 +140,7 @@ void DialogPreferences::PageChanged(QListWidgetItem *current, QListWidgetItem *p
{
current = previous;
}
int rowIndex = ui->contentsWidget->row(current);
int const rowIndex = ui->contentsWidget->row(current);
ui->pagesWidget->setCurrentIndex(rowIndex);
}

View File

@ -375,7 +375,7 @@ void DialogSaveLayout::Save()
Path() + '/' + FileName() + QString::number(i + 1) + VLayoutExporter::ExportFormatSuffix(Format());
if (QFile::exists(name))
{
QMessageBox::StandardButton res = QMessageBox::question(
QMessageBox::StandardButton const res = QMessageBox::question(
this, tr("Name conflict"),
tr("Folder already contain file with name %1. Rewrite all conflict file names?").arg(name),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
@ -570,7 +570,7 @@ void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::GetTiledMargins() const -> QMarginsF
{
QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(),
QMarginsF const margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(),
ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value());
return UnitConvertor(margins, VAbstractValApplication::VApp()->patternUnits(), Unit::Mm);
@ -579,7 +579,7 @@ auto DialogSaveLayout::GetTiledMargins() const -> QMarginsF
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::SetTiledPageFormat(PaperSizeTemplate format)
{
int index = ui->comboBoxTemplates->findData(static_cast<int>(format));
int const index = ui->comboBoxTemplates->findData(static_cast<int>(format));
if (index != -1)
{
ui->comboBoxTemplates->setCurrentIndex(index);
@ -811,7 +811,7 @@ void DialogSaveLayout::WriteSettings() const
const Unit unit = VAbstractValApplication::VApp()->patternUnits();
// write Margins top, right, bottom, left
QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(),
QMarginsF const margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(),
ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value());
settings->SetTiledPDFMargins(margins, unit);

View File

@ -209,13 +209,13 @@ void VWidgetBackgroundImages::UpdateImages()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::UpdateImage(const QUuid &id)
{
int row = ImageRow(id);
int const row = ImageRow(id);
if (row == -1)
{
return;
}
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
if (image.IsNull())
{
return;
@ -238,7 +238,7 @@ void VWidgetBackgroundImages::UpdateImage(const QUuid &id)
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::ImageSelected(const QUuid &id)
{
int row = ImageRow(id);
int const row = ImageRow(id);
ui->tableWidget->blockSignals(true);
ui->tableWidget->setCurrentCell(row, ImageData::Name);
@ -308,7 +308,7 @@ void VWidgetBackgroundImages::ContextMenu(const QPoint &pos)
const int row = item->row();
item = ui->tableWidget->item(row, 0);
const QUuid id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
if (image.IsNull())
{
return;
@ -428,7 +428,7 @@ void VWidgetBackgroundImages::CurrentImageChanged(int currentRow, int currentCol
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::MoveImageOnTop()
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -437,7 +437,7 @@ void VWidgetBackgroundImages::MoveImageOnTop()
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Top, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command);
}
@ -446,7 +446,7 @@ void VWidgetBackgroundImages::MoveImageOnTop()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::MoveImageUp()
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -455,7 +455,7 @@ void VWidgetBackgroundImages::MoveImageUp()
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Up, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command);
}
@ -464,7 +464,7 @@ void VWidgetBackgroundImages::MoveImageUp()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::MoveImageDown()
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -473,7 +473,7 @@ void VWidgetBackgroundImages::MoveImageDown()
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Down, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command);
}
@ -482,7 +482,7 @@ void VWidgetBackgroundImages::MoveImageDown()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::MoveImageBottom()
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -491,7 +491,7 @@ void VWidgetBackgroundImages::MoveImageBottom()
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Bottom, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command);
}
@ -500,7 +500,7 @@ void VWidgetBackgroundImages::MoveImageBottom()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::ApplyImageTransformation()
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -512,8 +512,8 @@ void VWidgetBackgroundImages::ApplyImageTransformation()
return;
}
QUuid id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
QUuid const id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
if (image.IsNull() || image.Hold())
{
@ -528,7 +528,7 @@ void VWidgetBackgroundImages::ApplyImageTransformation()
if (not ui->checkBoxRelativeTranslation->isChecked())
{
QRectF rect = image.BoundingRect();
QRectF const rect = image.BoundingRect();
dx = dx - rect.topLeft().x();
dy = dy - rect.topLeft().y();
}
@ -538,14 +538,14 @@ void VWidgetBackgroundImages::ApplyImageTransformation()
}
else if (ui->tabWidgetImageTransformation->indexOf(ui->tabScale) == index)
{ // scale
qreal sx =
qreal const sx =
WidthScaleUnitConvertor(ui->doubleSpinBoxScaleWidth->value(), CurrentScaleUnit(), ScaleUnit::Percent) / 100;
qreal sy =
qreal const sy =
HeightScaleUnitConvertor(ui->doubleSpinBoxScaleHeight->value(), CurrentScaleUnit(), ScaleUnit::Percent) /
100;
QTransform imageMatrix = image.Matrix();
QPointF originPos = image.BoundingRect().center();
QPointF const originPos = image.BoundingRect().center();
QTransform m;
m.translate(originPos.x(), originPos.y());
@ -567,7 +567,7 @@ void VWidgetBackgroundImages::ApplyImageTransformation()
QTransform imageMatrix = image.Matrix();
QPointF originPos = image.BoundingRect().center();
QPointF const originPos = image.BoundingRect().center();
QTransform m;
m.translate(originPos.x(), originPos.y());
@ -600,7 +600,7 @@ void VWidgetBackgroundImages::ResetImageTransformationSettings()
}
}
int unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(static_cast<int>(Unit::Px)));
int const unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(static_cast<int>(Unit::Px)));
if (unitIndex != -1)
{
ui->comboBoxTranslateUnit->setCurrentIndex(unitIndex);
@ -608,7 +608,7 @@ void VWidgetBackgroundImages::ResetImageTransformationSettings()
}
else if (ui->tabWidgetImageTransformation->indexOf(ui->tabScale) == index)
{ // scale
int unitIndex = ui->comboBoxScaleUnit->findData(QVariant(static_cast<int>(ScaleUnit::Percent)));
int const unitIndex = ui->comboBoxScaleUnit->findData(QVariant(static_cast<int>(ScaleUnit::Percent)));
if (unitIndex != -1)
{
ui->comboBoxScaleUnit->setCurrentIndex(unitIndex);
@ -633,7 +633,7 @@ void VWidgetBackgroundImages::RelativeTranslationChanged(bool checked)
}
else
{
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -642,7 +642,7 @@ void VWidgetBackgroundImages::RelativeTranslationChanged(bool checked)
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
QUuid const id = item->data(Qt::UserRole).toUuid();
SetAbsolutePisition(id);
}
}
@ -653,7 +653,7 @@ void VWidgetBackgroundImages::ScaleProportionallyChanged(bool checked)
{
if (checked)
{
qreal value = ui->doubleSpinBoxScaleWidth->value();
qreal const value = ui->doubleSpinBoxScaleWidth->value();
ui->doubleSpinBoxScaleHeight->setValue(value);
}
}
@ -663,7 +663,7 @@ void VWidgetBackgroundImages::ScaleWidthChanged(double value)
{
if (ui->checkBoxScaleProportionally->isChecked())
{
ScaleUnit unit = CurrentScaleUnit();
ScaleUnit const unit = CurrentScaleUnit();
if (unit == ScaleUnit::Percent)
{
ui->doubleSpinBoxScaleHeight->blockSignals(true);
@ -672,9 +672,9 @@ void VWidgetBackgroundImages::ScaleWidthChanged(double value)
}
else
{
qreal factor = WidthScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.;
qreal heightPx = ImageHeight() * factor;
qreal height = HeightScaleUnitConvertor(heightPx, ScaleUnit::Px, unit);
qreal const factor = WidthScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.;
qreal const heightPx = ImageHeight() * factor;
qreal const height = HeightScaleUnitConvertor(heightPx, ScaleUnit::Px, unit);
ui->doubleSpinBoxScaleHeight->blockSignals(true);
ui->doubleSpinBoxScaleHeight->setValue(height);
@ -688,7 +688,7 @@ void VWidgetBackgroundImages::ScaleHeightChanged(double value)
{
if (ui->checkBoxScaleProportionally->isChecked())
{
ScaleUnit unit = CurrentScaleUnit();
ScaleUnit const unit = CurrentScaleUnit();
if (unit == ScaleUnit::Percent)
{
ui->doubleSpinBoxScaleWidth->blockSignals(true);
@ -697,9 +697,9 @@ void VWidgetBackgroundImages::ScaleHeightChanged(double value)
}
else
{
qreal factor = HeightScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.;
qreal widthPx = ImageWidth() * factor;
qreal width = WidthScaleUnitConvertor(widthPx, ScaleUnit::Px, unit);
qreal const factor = HeightScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.;
qreal const widthPx = ImageWidth() * factor;
qreal const width = WidthScaleUnitConvertor(widthPx, ScaleUnit::Px, unit);
ui->doubleSpinBoxScaleHeight->blockSignals(true);
ui->doubleSpinBoxScaleHeight->setValue(width);
@ -716,7 +716,7 @@ void VWidgetBackgroundImages::ImagePositionChanged(const QUuid &id)
return;
}
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
@ -725,7 +725,7 @@ void VWidgetBackgroundImages::ImagePositionChanged(const QUuid &id)
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid curentId = item->data(Qt::UserRole).toUuid();
QUuid const curentId = item->data(Qt::UserRole).toUuid();
if (curentId != id)
{
return;
@ -788,7 +788,7 @@ void VWidgetBackgroundImages::FillTable(const QVector<VBackgroundPatternImage> &
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::ToggleImageHold(const QUuid &id) const
{
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
if (not image.IsNull())
{
auto *command = new HoldBackgroundImage(image.Id(), not image.Hold(), m_doc);
@ -799,7 +799,7 @@ void VWidgetBackgroundImages::ToggleImageHold(const QUuid &id) const
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::ToggleImageVisibility(const QUuid &id) const
{
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
if (not image.IsNull())
{
auto *command = new HideBackgroundImage(image.Id(), image.Visible(), m_doc);
@ -972,14 +972,14 @@ auto VWidgetBackgroundImages::ImageWidth() const -> qreal
{
qreal width = 0;
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row != -1)
{
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
QUuid const id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
width = image.Size().width();
}
}
@ -992,14 +992,14 @@ auto VWidgetBackgroundImages::ImageHeight() const -> qreal
{
qreal height = 0;
int row = ui->tableWidget->currentRow();
int const row = ui->tableWidget->currentRow();
if (row != -1)
{
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
QUuid const id = item->data(Qt::UserRole).toUuid();
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
height = image.Size().height();
}
}
@ -1022,8 +1022,8 @@ auto VWidgetBackgroundImages::HeightScaleUnitConvertor(qreal value, ScaleUnit fr
//---------------------------------------------------------------------------------------------------------------------
void VWidgetBackgroundImages::SetAbsolutePisition(const QUuid &id)
{
VBackgroundPatternImage image = m_doc->GetBackgroundImage(id);
QRectF rect = image.BoundingRect();
VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id);
QRectF const rect = image.BoundingRect();
ui->doubleSpinBoxImageHorizontalTranslate->setValue(
UnitConvertor(rect.topLeft().x(), Unit::Px, CurrentTranslateUnit()));

View File

@ -210,7 +210,7 @@ void VWidgetDetails::ToggledPieceItem(QTableWidgetItem *item)
{
SCASSERT(item != nullptr)
quint32 id = item->data(Qt::UserRole).toUInt();
quint32 const id = item->data(Qt::UserRole).toUInt();
const QHash<quint32, VPiece> *details = m_data->DataPieces();
if (details->contains(id))
@ -292,7 +292,7 @@ auto VWidgetDetails::PreparePieceNameColumnCell(const VPiece &det) -> QTableWidg
//---------------------------------------------------------------------------------------------------------------------
void VWidgetDetails::ShowContextMenu(const QPoint &pos)
{
QScopedPointer<QMenu> menu(new QMenu());
QScopedPointer<QMenu> const menu(new QMenu());
QAction *actionSelectAll = menu->addAction(tr("Select all"));
QAction *actionSelectNone = menu->addAction(tr("Select none"));

View File

@ -70,7 +70,7 @@ void VWidgetGroups::SetGroupVisibility(vidtype id, bool visible) const
connect(changeGroup, &ChangeGroupVisibility::UpdateGroup, this,
[this](vidtype id, bool visible)
{
int row = GroupRow(id);
int const row = GroupRow(id);
if (row == -1)
{
return;
@ -97,7 +97,7 @@ void VWidgetGroups::SetMultipleGroupsVisibility(const QVector<vidtype> &groups,
QMap<vidtype, bool>::const_iterator i = groups.constBegin();
while (i != groups.constEnd())
{
int row = GroupRow(i.key());
int const row = GroupRow(i.key());
if (row == -1)
{
++i;
@ -122,7 +122,8 @@ void VWidgetGroups::SetMultipleGroupsVisibility(const QVector<vidtype> &groups,
auto VWidgetGroups::FilterGroups(const QMap<quint32, VGroupData> &groups) -> QMap<quint32, VGroupData>
{
QMap<quint32, VGroupData> filtered;
QSet<QString> filterCategories = ConvertToSet<QString>(VAbstractPattern::FilterGroupTags(ui->lineEditTags->text()));
QSet<QString> const filterCategories =
ConvertToSet<QString>(VAbstractPattern::FilterGroupTags(ui->lineEditTags->text()));
if (filterCategories.isEmpty())
{
@ -133,7 +134,7 @@ auto VWidgetGroups::FilterGroups(const QMap<quint32, VGroupData> &groups) -> QMa
while (i != groups.constEnd())
{
const VGroupData &data = i.value();
QSet<QString> groupCategories = ConvertToSet<QString>(data.tags);
QSet<QString> const groupCategories = ConvertToSet<QString>(data.tags);
if (filterCategories.intersects(groupCategories))
{
filtered.insert(i.key(), data);
@ -164,10 +165,10 @@ auto VWidgetGroups::GroupRow(vidtype id) const -> int
//---------------------------------------------------------------------------------------------------------------------
void VWidgetGroups::ActionPreferences(quint32 id)
{
QScopedPointer<VContainer> fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(),
QScopedPointer<VContainer> const fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(),
VAbstractValApplication::VApp()->patternUnitsP(),
VContainer::UniqueNamespace()));
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), m_doc, NULL_ID, this));
QScopedPointer<DialogGroup> const dialog(new DialogGroup(fackeContainer.data(), m_doc, NULL_ID, this));
dialog->SetName(m_doc->GetGroupName(id));
dialog->SetTags(m_doc->GetGroupTags(id));
dialog->SetGroupCategories(m_doc->GetGroupCategories());
@ -194,7 +195,7 @@ void VWidgetGroups::ActionHideAll()
for (int r = 0; r < ui->tableWidget->rowCount(); ++r)
{
QTableWidgetItem *rowItem = ui->tableWidget->item(r, 0);
quint32 i = rowItem->data(Qt::UserRole).toUInt();
quint32 const i = rowItem->data(Qt::UserRole).toUInt();
if (m_doc->GetGroupVisibility(i))
{
groups.append(i);
@ -220,7 +221,7 @@ void VWidgetGroups::ActionShowAll()
for (int r = 0; r < ui->tableWidget->rowCount(); ++r)
{
QTableWidgetItem *rowItem = ui->tableWidget->item(r, 0);
quint32 i = rowItem->data(Qt::UserRole).toUInt();
quint32 const i = rowItem->data(Qt::UserRole).toUInt();
if (not m_doc->GetGroupVisibility(i))
{
groups.append(i);
@ -286,7 +287,7 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
return false;
};
QScopedPointer<QMenu> menu(new QMenu());
QScopedPointer<QMenu> const menu(new QMenu());
const QString resource = QStringLiteral("icon");
QAction *triggerVisibilityMenu =
m_doc->GetGroupVisibility(id)

View File

@ -288,7 +288,7 @@ auto SortDetailsForLayout(const QHash<quint32, VPiece> *allDetails, const QStrin
}
else
{
QRegularExpression nameRe(nameRegex);
QRegularExpression const nameRe(nameRegex);
while (i != allDetails->constEnd())
{
if (nameRe.match(i.value().GetName()).hasMatch())
@ -852,8 +852,8 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
cursorResource = cursorHiDPIResource;
}
}
QPixmap pixmap(cursorResource);
QCursor cur(pixmap, 2, 2);
QPixmap const pixmap(cursorResource);
QCursor const cur(pixmap, 2, 2);
ui->view->viewport()->setCursor(cur);
ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor
}
@ -1603,7 +1603,7 @@ void MainWindow::PlaceBackgroundImage(const QPointF &pos, const QString &fileNam
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::RemoveBackgroundImage(const QUuid &id)
{
VBackgroundPatternImage image = doc->GetBackgroundImage(id);
VBackgroundPatternImage const image = doc->GetBackgroundImage(id);
auto *deleteBackgroundImage = new DeleteBackgroundImage(image, doc);
connect(deleteBackgroundImage, &DeleteBackgroundImage::AddItem, this, &MainWindow::AddBackgroundImageItem);
@ -1971,7 +1971,7 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
while (iMap.hasNext())
{
iMap.next();
QSharedPointer<VIncrement> incr = increments.value(iMap.value());
QSharedPointer<VIncrement> const incr = increments.value(iMap.value());
currentRow++;
csv.insertRow(currentRow);
@ -1979,7 +1979,7 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
csv.setText(currentRow, 1,
VAbstractApplication::VApp()->LocaleToString(*incr->GetValue())); // calculated value
QString formula = VTranslateVars::TryFormulaToUser(
QString const formula = VTranslateVars::TryFormulaToUser(
incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
csv.setText(currentRow, 2, formula); // formula
}
@ -2062,7 +2062,7 @@ void MainWindow::LoadMultisize()
const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") + tr("Individual measurements") +
QStringLiteral("(*.vit)");
// Use standard path to multisize measurements
QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
QString const path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -2204,7 +2204,7 @@ void MainWindow::ShowMeasurements()
void MainWindow::MeasurementsChanged(const QString &path)
{
m_mChanges = false;
QFileInfo checkFile(path);
QFileInfo const checkFile(path);
if (checkFile.exists())
{
m_mChanges = true;
@ -2279,7 +2279,7 @@ void MainWindow::EditCurrentWatermark()
{
CleanWaterkmarkEditors();
QString watermarkFile = doc->GetWatermarkPath();
QString const watermarkFile = doc->GetWatermarkPath();
if (not watermarkFile.isEmpty())
{
OpenWatermark(watermarkFile);
@ -2290,7 +2290,7 @@ void MainWindow::EditCurrentWatermark()
void MainWindow::LoadWatermark()
{
const QString filter(tr("Watermark files") + QStringLiteral(" (*.vwm)"));
QString dir = QDir::homePath();
QString const dir = QDir::homePath();
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -2322,7 +2322,7 @@ void MainWindow::CleanWaterkmarkEditors()
QMutableListIterator<QPointer<WatermarkWindow>> i(m_watermarkEditors);
while (i.hasNext())
{
QPointer<WatermarkWindow> watermarkEditor = i.next();
QPointer<WatermarkWindow> const watermarkEditor = i.next();
if (watermarkEditor.isNull())
{
i.remove();
@ -2335,7 +2335,7 @@ void MainWindow::StoreMultisizeMDimensions()
{
VAbstractValApplication::VApp()->SetMeasurementsUnits(m_m->Units());
QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
QList<MeasurementDimension_p> const dimensions = m_m->Dimensions().values();
if (not dimensions.isEmpty())
{
@ -2369,7 +2369,7 @@ void MainWindow::StoreMultisizeMDimensions()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::StoreIndividualMDimensions()
{
QMap<QString, QSharedPointer<VMeasurement>> measurements = pattern->DataMeasurements();
QMap<QString, QSharedPointer<VMeasurement>> const measurements = pattern->DataMeasurements();
StoreIndividualMDimension(measurements, IMD::X);
StoreIndividualMDimension(measurements, IMD::Y);
@ -2549,10 +2549,10 @@ void MainWindow::ExportDraw(const QString &fileName)
exporter.SetFileName(fileName);
int verticalScrollBarValue = ui->view->verticalScrollBar()->value();
int horizontalScrollBarValue = ui->view->horizontalScrollBar()->value();
int const verticalScrollBarValue = ui->view->verticalScrollBar()->value();
int const horizontalScrollBarValue = ui->view->horizontalScrollBar()->value();
QTransform viewTransform = ui->view->transform();
QTransform const viewTransform = ui->view->transform();
ui->view->ZoomFitBest(); // Resize all labels
ui->view->repaint();
ui->view->ZoomOriginal(); // Set to original scale
@ -2942,7 +2942,7 @@ void MainWindow::ToolBarDraws()
[this]()
{
QString draw = doc->GetNameActivPP();
bool ok = PatternPieceName(draw);
bool const ok = PatternPieceName(draw);
if (not ok)
{
return;
@ -4087,8 +4087,8 @@ void MainWindow::ActionLayout(bool checked)
auto MainWindow::on_actionSaveAs_triggered() -> bool
{
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
QString patternPath = VAbstractValApplication::VApp()->GetPatternPath();
QString dir = patternPath.isEmpty() ? settings->GetPathPattern() : QFileInfo(patternPath).absolutePath();
QString const patternPath = VAbstractValApplication::VApp()->GetPatternPath();
QString const dir = patternPath.isEmpty() ? settings->GetPathPattern() : QFileInfo(patternPath).absolutePath();
QString newFileName = tr("pattern") + QStringLiteral(".val");
if (not patternPath.isEmpty())
@ -4096,7 +4096,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
newFileName = QFileInfo(patternPath).fileName();
}
QString filters(tr("Pattern files") + QStringLiteral("(*.val)"));
QString const filters(tr("Pattern files") + QStringLiteral("(*.val)"));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + newFileName, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -4105,7 +4105,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
return false;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() && f.suffix() != "val"_L1)
{
fileName += ".val"_L1;
@ -4120,7 +4120,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
{
// Temporary try to lock the file before saving
// Also help to rewite current read-only pattern
VLockGuard<char> tmp(fileName);
VLockGuard<char> const tmp(fileName);
if (not tmp.IsLocked())
{
qCCritical(vMainWindow, "%s",
@ -4156,7 +4156,7 @@ auto MainWindow::on_actionSave_triggered() -> bool
}
QString error;
bool result = SavePattern(VAbstractValApplication::VApp()->GetPatternPath(), error);
bool const result = SavePattern(VAbstractValApplication::VApp()->GetPatternPath(), error);
if (result)
{
QFile::remove(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix);
@ -4226,7 +4226,7 @@ void MainWindow::on_actionCreateManualLayout_triggered()
QTemporaryFile rldFile(QDir::tempPath() + "/puzzle.rld.XXXXXX"_L1);
if (rldFile.open())
{
QVector<DetailForLayout> detailsInLayout = SortDetailsForLayout(pattern->DataPieces());
QVector<DetailForLayout> const detailsInLayout = SortDetailsForLayout(pattern->DataPieces());
if (detailsInLayout.count() == 0)
{
@ -4306,7 +4306,7 @@ void MainWindow::on_actionUpdateManualLayout_triggered()
rldFile.setAutoRemove(false);
if (rldFile.open())
{
QVector<DetailForLayout> detailsInLayout = SortDetailsForLayout(pattern->DataPieces());
QVector<DetailForLayout> const detailsInLayout = SortDetailsForLayout(pattern->DataPieces());
if (detailsInLayout.count() == 0)
{
@ -4366,7 +4366,7 @@ void MainWindow::ActionAddBackgroundImage()
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (not fileName.isEmpty())
{
QRect viewportRect(0, 0, ui->view->viewport()->width(), ui->view->viewport()->height());
QRect const viewportRect(0, 0, ui->view->viewport()->width(), ui->view->viewport()->height());
PlaceBackgroundImage(ui->view->mapToScene(viewportRect.center()), fileName);
}
}
@ -4379,7 +4379,7 @@ void MainWindow::ActionExportFontCorrections()
const QString dirPath = settings->GetPathFontCorrections();
bool usedNotExistedDir = false;
QDir directory(dirPath);
QDir const directory(dirPath);
if (not directory.exists())
{
usedNotExistedDir = directory.mkpath(QChar('.'));
@ -4390,7 +4390,7 @@ void MainWindow::ActionExportFontCorrections()
{
if (usedNotExistedDir)
{
QDir directory(dirPath);
QDir const directory(dirPath);
directory.rmpath(QChar('.'));
}
});
@ -4400,7 +4400,7 @@ void MainWindow::ActionExportFontCorrections()
VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
if (not dir.isEmpty())
{
VSingleLineOutlineChar corrector(settings->GetLabelFont());
VSingleLineOutlineChar const corrector(settings->GetLabelFont());
corrector.ExportCorrections(dir);
}
}
@ -4924,7 +4924,7 @@ void MainWindow::AskDefaultSettings()
QGuiApplication::restoreOverrideCursor();
if (dialog.exec() == QDialog::Accepted)
{
QString locale = dialog.Locale();
QString const locale = dialog.Locale();
settings->SetLocale(locale);
VAbstractApplication::VApp()->LoadTranslation(locale);
}
@ -5004,7 +5004,7 @@ void MainWindow::ShowBackgroundImageInExplorer(const QUuid &id)
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SaveBackgroundImage(const QUuid &id)
{
VBackgroundPatternImage image = doc->GetBackgroundImage(id);
VBackgroundPatternImage const image = doc->GetBackgroundImage(id);
if (not image.IsValid())
{
@ -5019,13 +5019,13 @@ void MainWindow::SaveBackgroundImage(const QUuid &id)
}
const QByteArray imageData = QByteArray::fromBase64(image.ContentData());
QMimeType mime = MimeTypeFromByteArray(imageData);
QMimeType const mime = MimeTypeFromByteArray(imageData);
QString path = QDir::homePath() + QDir::separator() + tr("untitled");
QStringList filters;
if (mime.isValid())
{
QStringList suffixes = mime.suffixes();
QStringList const suffixes = mime.suffixes();
if (not suffixes.isEmpty())
{
path += '.'_L1 + suffixes.at(0);
@ -5036,9 +5036,9 @@ void MainWindow::SaveBackgroundImage(const QUuid &id)
filters.append(tr("All files") + " (*.*)"_L1);
QString filter = filters.join(QStringLiteral(";;"));
QString const filter = filters.join(QStringLiteral(";;"));
QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (not filename.isEmpty())
{
@ -5061,7 +5061,7 @@ void MainWindow::ParseBackgroundImages()
m_backgroudcontrols = nullptr; // force creating new controls
m_backgroundImages.clear(); // clear dangling pointers
QVector<VBackgroundPatternImage> allImages = doc->GetBackgroundImages();
QVector<VBackgroundPatternImage> const allImages = doc->GetBackgroundImages();
for (const auto &image : allImages)
{
NewBackgroundImageItem(image);
@ -5097,8 +5097,8 @@ void MainWindow::ActionHistory_triggered(bool checked)
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionExportRecipe_triggered()
{
QString filters(tr("Recipe files") + QStringLiteral("(*.vpr)"));
QString fileName = QFileDialog::getSaveFileName(this, tr("Export recipe"),
QString const filters(tr("Recipe files") + QStringLiteral("(*.vpr)"));
QString const fileName = QFileDialog::getSaveFileName(this, tr("Export recipe"),
QDir::homePath() + '/' + tr("recipe") + QStringLiteral(".vpr"),
filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
@ -5129,7 +5129,7 @@ void MainWindow::ActionNewDraw_triggered()
qCDebug(vMainWindow, "Generated PP name: %s", qUtf8Printable(patternPieceName));
qCDebug(vMainWindow, "PP count %d", m_comboBoxDraws->count());
bool ok = PatternPieceName(patternPieceName);
bool const ok = PatternPieceName(patternPieceName);
qCDebug(vMainWindow, "PP name: %s", qUtf8Printable(patternPieceName));
if (not ok)
{
@ -5371,11 +5371,11 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
}
// Calculate the width of the largest item using QFontMetrics
QFontMetrics fontMetrics(control->font());
QFontMetrics const fontMetrics(control->font());
int maxWidth = 0;
for (int i = 0; i < control->count(); ++i)
{
int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
int const itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
if (itemWidth > maxWidth)
{
maxWidth = itemWidth;
@ -5389,7 +5389,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
// it invalid first
control->setCurrentIndex(-1);
int i = control->findData(current);
int const i = control->findData(current);
if (i != -1)
{
control->setCurrentIndex(i);
@ -5576,7 +5576,7 @@ void MainWindow::MinimumScrollBar()
auto MainWindow::SavePattern(const QString &fileName, QString &error) -> bool
{
qCDebug(vMainWindow, "Saving pattern file %s.", qUtf8Printable(fileName));
QFileInfo tempInfo(fileName);
QFileInfo const tempInfo(fileName);
const QString mPath = AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath());
if (not mPath.isEmpty() && VAbstractValApplication::VApp()->GetPatternPath() != fileName)
@ -5744,7 +5744,7 @@ auto MainWindow::MaybeSave() -> bool
{
if (this->isWindowModified() && m_guiEnabled)
{
QScopedPointer<QMessageBox> messageBox(
QScopedPointer<QMessageBox> const messageBox(
new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"),
tr("The pattern has been modified. Do you want to save your changes?"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet));
@ -6278,7 +6278,7 @@ void MainWindow::InitAutoSave()
//---------------------------------------------------------------------------------------------------------------------
auto MainWindow::PatternPieceName(QString &name) -> bool
{
QScopedPointer<QInputDialog> dlg(new QInputDialog(this));
QScopedPointer<QInputDialog> const dlg(new QInputDialog(this));
dlg->setInputMode(QInputDialog::TextInput);
dlg->setLabelText(tr("Pattern piece:"));
dlg->setTextEchoMode(QLineEdit::Normal);
@ -6328,14 +6328,14 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
qCDebug(vMainWindow, "Loading new file %s.", qUtf8Printable(fileName));
{ // Convert to absolute path if need
QFileInfo info(fileName);
QFileInfo const info(fileName);
if (info.exists() && info.isRelative())
{
fileName = QFileInfo(QDir::currentPath() + '/'_L1 + fileName).canonicalFilePath();
}
}
QFuture<VPatternConverter *> futureConverter = QtConcurrent::run(
QFuture<VPatternConverter *> const futureConverter = QtConcurrent::run(
[fileName]()
{
std::unique_ptr<VPatternConverter> converter(new VPatternConverter(fileName));
@ -6455,7 +6455,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
if (currentFormatVersion != VPatternConverter::PatternMaxVer)
{ // Because we rely on the fact that we know where is path to measurements optimization available only for
// the latest format version
QScopedPointer<VPatternConverter> converter(futureConverter.result());
QScopedPointer<VPatternConverter> const converter(futureConverter.result());
m_curFileFormatVersion = converter->GetCurrentFormatVersion();
m_curFileFormatVersionStr = converter->GetFormatVersionStr();
doc->setXMLContent(converter->Convert());
@ -6556,7 +6556,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
if (currentFormatVersion == VPatternConverter::PatternMaxVer)
{
// Real read
QScopedPointer<VPatternConverter> converter(futureConverter.result());
QScopedPointer<VPatternConverter> const converter(futureConverter.result());
m_curFileFormatVersion = converter->GetCurrentFormatVersion();
m_curFileFormatVersionStr = converter->GetFormatVersionStr();
doc->setXMLContent(converter->Convert());
@ -6643,7 +6643,7 @@ auto MainWindow::GetUnlokedRestoreFileList() -> QStringList
for (auto &file : files)
{
// Seeking file that realy need reopen
VLockGuard<char> tmp(file);
VLockGuard<char> const tmp(file);
if (tmp.IsLocked())
{
restoreFiles.append(file);
@ -6687,7 +6687,7 @@ void MainWindow::ToolboxIconSize()
auto SetIconSize = [](QToolBar *bar)
{
VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
QSize size = settings->GetToolboxIconSizeSmall() ? QSize(24, 24) : QSize(32, 32);
QSize const size = settings->GetToolboxIconSizeSmall() ? QSize(24, 24) : QSize(32, 32);
bar->setIconSize(size);
};
@ -6724,7 +6724,7 @@ void MainWindow::Preferences()
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
auto *preferences = new DialogPreferences(this);
// QScopedPointer needs to be sure any exception will never block guard
QScopedPointer<DialogPreferences> dlg(preferences);
QScopedPointer<DialogPreferences> const dlg(preferences);
guard = preferences;
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
connect(dlg.data(), &DialogPreferences::UpdateProperties, m_toolOptions,
@ -6770,8 +6770,8 @@ void MainWindow::ExportDrawAs(bool checked)
auto Uncheck = qScopeGuard([this] { ui->actionExportDraw->setChecked(false); });
QString filters(tr("Scalable Vector Graphics files") + QStringLiteral("(*.svg)"));
QString dir = QDir::homePath() + '/'_L1 + FileName() + QStringLiteral(".svg");
QString const filters(tr("Scalable Vector Graphics files") + QStringLiteral("(*.svg)"));
QString const dir = QDir::homePath() + '/'_L1 + FileName() + QStringLiteral(".svg");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save draw"), dir, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -6780,7 +6780,7 @@ void MainWindow::ExportDrawAs(bool checked)
return;
}
QFileInfo f(fileName);
QFileInfo const f(fileName);
if (f.suffix().isEmpty() || f.suffix() != "svg"_L1)
{
fileName += ".svg"_L1;
@ -6835,7 +6835,7 @@ void MainWindow::ExportDetailsAs(bool checked)
auto Uncheck = qScopeGuard([this] { ui->actionDetailExportAs->setChecked(false); });
QVector<DetailForLayout> detailsInLayout = SortDetailsForLayout(pattern->DataPieces());
QVector<DetailForLayout> const detailsInLayout = SortDetailsForLayout(pattern->DataPieces());
if (detailsInLayout.count() == 0)
{
@ -6964,7 +6964,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
return mPath;
};
QFileInfo table(path);
QFileInfo const table(path);
if (table.exists())
{
return path;
@ -6978,7 +6978,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
const QString text = tr("The measurements file <br/><br/> <b>%1</b> <br/><br/> could not be found. Do you "
"want to update the file location?")
.arg(path);
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Loading measurements file"), text,
QMessageBox::StandardButton const res = QMessageBox::question(this, tr("Loading measurements file"), text,
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (res == QMessageBox::No)
{
@ -7052,7 +7052,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
return mPath;
}
QScopedPointer<VMeasurements> m(new VMeasurements(pattern));
QScopedPointer<VMeasurements> const m(new VMeasurements(pattern));
m->setXMLContent(mPath);
patternType = m->Type();
@ -7313,7 +7313,7 @@ auto MainWindow::DoFMExport(const VCommandLinePtr &expParams) -> bool
return false;
}
QFileInfo info(filePath);
QFileInfo const info(filePath);
if (info.isRelative())
{
filePath = QDir::currentPath() + '/'_L1 + filePath;

View File

@ -106,7 +106,7 @@ void RemoveLayoutPath(const QString &path, bool usedNotExistedDir)
{
if (usedNotExistedDir)
{
QDir dir(path);
QDir const dir(path);
dir.rmpath(QChar('.'));
}
}
@ -474,7 +474,7 @@ void MainWindowsNoGUI::ShowLayoutError(const LayoutErrors &state)
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::ExportFMeasurementsToCSV()
{
QString fileName = CSVFilePath();
QString const fileName = CSVFilePath();
if (fileName.isEmpty())
{
@ -546,7 +546,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes, c
const QMarginsF &margins)
{
const QString path = m_dialogSaveLayout->Path();
bool usedNotExistedDir = CreateLayoutPath(path);
bool const usedNotExistedDir = CreateLayoutPath(path);
if (not usedNotExistedDir)
{
qCritical() << tr("Can't create a path");
@ -577,7 +577,7 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &li
return;
}
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
QScopedPointer<QGraphicsScene> const scene(new QGraphicsScene());
QList<QGraphicsItem *> list;
list.reserve(listDetails.count());
@ -635,8 +635,8 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &li
QList<QList<QGraphicsItem *>> details; // All details
details.append(list);
QList<QGraphicsItem *> shadows = CreateShadows(papers);
QList<QGraphicsScene *> scenes = CreateScenes(papers, shadows, details);
QList<QGraphicsItem *> const shadows = CreateShadows(papers);
QList<QGraphicsScene *> const scenes = CreateScenes(papers, shadows, details);
const bool ignorePrinterFields = false;
Q_RELAXED_CONSTEXPR qreal margin = ToPixel(1, Unit::Cm);
@ -650,7 +650,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector<VLayoutPiece> &details,
const QSize &size) const
{
const QString path = m_dialogSaveLayout->Path();
bool usedNotExistedDir = CreateLayoutPath(path);
bool const usedNotExistedDir = CreateLayoutPath(path);
if (not usedNotExistedDir)
{
qCritical() << tr("Can't create a path");
@ -717,7 +717,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDe
return;
}
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
QScopedPointer<QGraphicsScene> const scene(new QGraphicsScene());
QList<QGraphicsItem *> list;
list.reserve(listDetails.count());
@ -809,7 +809,7 @@ void MainWindowsNoGUI::PrintPreviewTiled()
m_layoutSettings->SetTiledMargins(m_dialogSaveLayout->GetTiledMargins());
m_layoutSettings->SetTiledPDFOrientation(m_dialogSaveLayout->GetTiledPageOrientation());
VAbstractLayoutDialog::PaperSizeTemplate tiledFormat = m_dialogSaveLayout->GetTiledPageFormat();
VAbstractLayoutDialog::PaperSizeTemplate const tiledFormat = m_dialogSaveLayout->GetTiledPageFormat();
m_layoutSettings->SetTiledPDFPaperSize(VAbstractLayoutDialog::GetTemplateSize(tiledFormat, Unit::Mm));
}
else
@ -843,7 +843,7 @@ void MainWindowsNoGUI::PrintTiled()
m_layoutSettings->SetTiledMargins(m_dialogSaveLayout->GetTiledMargins());
m_layoutSettings->SetTiledPDFOrientation(m_dialogSaveLayout->GetTiledPageOrientation());
VAbstractLayoutDialog::PaperSizeTemplate tiledFormat = m_dialogSaveLayout->GetTiledPageFormat();
VAbstractLayoutDialog::PaperSizeTemplate const tiledFormat = m_dialogSaveLayout->GetTiledPageFormat();
m_layoutSettings->SetTiledPDFPaperSize(VAbstractLayoutDialog::GetTemplateSize(tiledFormat, Unit::Mm));
}
else
@ -868,7 +868,7 @@ auto MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<DetailForLayout> &d
return {};
}
std::function<VLayoutPiece(const DetailForLayout &data)> PrepareDetail = [](const DetailForLayout &data)
std::function<VLayoutPiece(const DetailForLayout &data)> const PrepareDetail = [](const DetailForLayout &data)
{
auto *tool = qobject_cast<VAbstractTool *>(VAbstractPattern::getTool(data.id));
SCASSERT(tool != nullptr)
@ -1028,7 +1028,7 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
m_layoutSettings->SetTiledMargins(m_dialogSaveLayout->GetTiledMargins());
m_layoutSettings->SetTiledPDFOrientation(m_dialogSaveLayout->GetTiledPageOrientation());
VAbstractLayoutDialog::PaperSizeTemplate tiledFormat = m_dialogSaveLayout->GetTiledPageFormat();
VAbstractLayoutDialog::PaperSizeTemplate const tiledFormat = m_dialogSaveLayout->GetTiledPageFormat();
m_layoutSettings->SetTiledPDFPaperSize(VAbstractLayoutDialog::GetTemplateSize(tiledFormat, Unit::Mm));
m_layoutSettings->SetXScale(m_dialogSaveLayout->GetXScale());
@ -1091,7 +1091,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes, const
exporter.SetFileName(name);
exporter.SetImageRect(paper->rect());
QPen defaultPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(), Qt::SolidLine,
QPen const defaultPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(), Qt::SolidLine,
Qt::RoundCap, Qt::RoundJoin);
switch (m_dialogSaveLayout->Format())
@ -1237,7 +1237,7 @@ auto MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, boo
{
try
{
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula);
csv.setText(i, 1, VAbstractApplication::VApp()->LocaleToString(result)); // value
@ -1383,7 +1383,7 @@ void MainWindowsNoGUI::CheckRequiredMeasurements(const VMeasurements *m) const
if (not match.isEmpty())
{
QStringList list = ConvertToList(match);
QStringList const list = ConvertToList(match);
VException e(tr("Measurement file doesn't include all required measurements."));
e.AddMoreInformation(tr("Please, additionally provide: %1").arg(list.join(", "_L1)));
throw e;

View File

@ -469,7 +469,7 @@ auto VPattern::GetActivePPPieces() const -> QVector<quint32>
QDomElement detail = details.firstChildElement(TagDetail);
while (not detail.isNull())
{
bool united = GetParametrBool(detail, VToolSeamAllowance::AttrUnited, falseStr);
bool const united = GetParametrBool(detail, VToolSeamAllowance::AttrUnited, falseStr);
if (not united)
{
pieces.append(GetParametrId(detail));
@ -496,7 +496,7 @@ auto VPattern::SaveDocument(const QString &fileName, QString &error) -> bool
}
// Update comment with Valentina version
QDomNode commentNode = documentElement().firstChild();
QDomNode const commentNode = documentElement().firstChild();
if (commentNode.isComment())
{
QDomComment comment = commentNode.toComment();
@ -599,9 +599,9 @@ void VPattern::LiteParseIncrements()
//---------------------------------------------------------------------------------------------------------------------
auto VPattern::ElementsToParse() const -> int
{
QVector<QString> tags{TagCalculation, TagDetails, TagModeling, TagIncrements};
QVector<QString> const tags{TagCalculation, TagDetails, TagModeling, TagIncrements};
std::function<int(const QString &tagName)> TagsCount = [this](const QString &tagName)
std::function<int(const QString &tagName)> const TagsCount = [this](const QString &tagName)
{ return elementsByTagName(tagName).length(); };
return QtConcurrent::blockingMappedReduced(tags, TagsCount, GatherCount);
@ -614,7 +614,7 @@ auto VPattern::ElementsToParse() const -> int
void VPattern::LiteParseTree(const Document &parse)
{
// Save name current pattern piece
QString namePP = nameActivPP;
QString const namePP = nameActivPP;
try
{
@ -753,7 +753,7 @@ auto VPattern::ParseDetailNode(const QDomElement &domElement) -> VNodeDetail
const QString t = GetParametrString(domElement, AttrType, QStringLiteral("NodePoint"));
Tool tool;
QStringList types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline,
QStringList const types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline,
VAbstractPattern::NodeSplinePath, VAbstractPattern::NodeElArc};
switch (types.indexOf(t))
{
@ -844,7 +844,7 @@ void VPattern::ParseRootElement(const Document &parse, const QDomNode &node)
*/
void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
{
QStringList tags{TagCalculation, TagModeling, TagDetails, TagGroups};
QStringList const tags{TagCalculation, TagModeling, TagDetails, TagGroups};
QDomNode domNode = node.firstChild();
while (not domNode.isNull())
{
@ -2001,7 +2001,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
return; // Just ignore
}
QSharedPointer<VPointF> p(new VPointF(*point));
QSharedPointer<VPointF> const p(new VPointF(*point));
p->setIdObject(initData.idObject);
p->setMode(Draw::Modeling);
p->SetShowLabel(GetParametrBool(domElement, AttrShowLabel, trueStr));
@ -2913,7 +2913,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, QDomElement &do
QLineF line(0, 0, 100, 0);
line.setAngle(angle + 180);
VFSplinePoint splPoint(p, kAsm1, line.angle(), kAsm2, angle);
VFSplinePoint const splPoint(p, kAsm1, line.angle(), kAsm2, angle);
points.append(splPoint);
if (parse == Document::FullParse)
{
@ -3646,7 +3646,7 @@ auto VPattern::MakeEmptyIncrement(const QString &name, IncrementType type) -> QD
//---------------------------------------------------------------------------------------------------------------------
auto VPattern::FindIncrement(const QString &name) const -> QDomElement
{
QDomNodeList list = elementsByTagName(TagIncrement);
QDomNodeList const list = elementsByTagName(TagIncrement);
for (int i = 0; i < list.size(); ++i)
{
@ -3669,7 +3669,7 @@ void VPattern::GarbageCollector(bool commit)
{
bool cleared = false;
QDomNodeList modelingList = elementsByTagName(TagModeling);
QDomNodeList const modelingList = elementsByTagName(TagModeling);
for (int i = 0; i < modelingList.size(); ++i)
{
QDomElement modElement = modelingList.at(i).toElement();
@ -3679,7 +3679,7 @@ void VPattern::GarbageCollector(bool commit)
while (not modNode.isNull())
{
// First get next sibling because later will not have chance to get it
QDomElement nextSibling = modNode.nextSibling().toElement();
QDomElement const nextSibling = modNode.nextSibling().toElement();
if (modNode.hasAttribute(VAbstractTool::AttrInUse))
{
const NodeUsage inUse = GetParametrUsage(modNode, VAbstractTool::AttrInUse);
@ -3698,7 +3698,7 @@ void VPattern::GarbageCollector(bool commit)
// Clear history
try
{
vidtype id = GetParametrId(modNode);
vidtype const id = GetParametrId(modNode);
auto record =
std::find_if(history.begin(), history.end(),
[id](const VToolRecord &record) { return record.getId() == id; });
@ -3950,7 +3950,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domEle
ParseToolCubicBezierPath(scene, domElement, parse);
break;
default:
VException e(tr("Unknown spline type '%1'.").arg(type));
VException const e(tr("Unknown spline type '%1'.").arg(type));
throw e;
}
}
@ -3970,7 +3970,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty");
QStringList arcs = QStringList() << VToolArc::ToolType /*0*/
QStringList const arcs = QStringList() << VToolArc::ToolType /*0*/
<< VNodeArc::ToolType /*1*/
<< VToolArcWithLength::ToolType; /*2*/
@ -3986,7 +3986,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
ParseToolArcWithLength(scene, domElement, parse);
break;
default:
VException e(tr("Unknown arc type '%1'.").arg(type));
VException const e(tr("Unknown arc type '%1'.").arg(type));
throw e;
}
}
@ -4018,7 +4018,7 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement
ParseNodeEllipticalArc(domElement, parse);
break;
default:
VException e(tr("Unknown elliptical arc type '%1'.").arg(type));
VException const e(tr("Unknown elliptical arc type '%1'.").arg(type));
throw e;
}
}
@ -4066,7 +4066,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
}
break;
default:
VException e(tr("Unknown tools type '%1'.").arg(type));
VException const e(tr("Unknown tools type '%1'.").arg(type));
throw e;
}
}
@ -4099,7 +4099,7 @@ void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &dom
ParseToolMove(scene, domElement, parse);
break;
default:
VException e(tr("Unknown operation type '%1'.").arg(type));
VException const e(tr("Unknown operation type '%1'.").arg(type));
throw e;
}
}
@ -4342,7 +4342,7 @@ void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const Q
// Eval formula
try
{
QScopedPointer<qmu::QmuTokenParser> cal(
QScopedPointer<qmu::QmuTokenParser> const cal(
new qmu::QmuTokenParser(expressions.at(i).expression, false, false));
tokens = cal->GetTokens(); // Tokens (variables, measurements)
}

View File

@ -201,7 +201,7 @@ void FvUpdater::SkipUpdate()
{
qDebug() << "Skip update";
QPointer<FvAvailableUpdate> proposedUpdate = GetProposedUpdate();
QPointer<FvAvailableUpdate> const proposedUpdate = GetProposedUpdate();
if (proposedUpdate.isNull())
{
qWarning() << "Proposed update is NULL (shouldn't be at this point)";
@ -229,7 +229,7 @@ void FvUpdater::UpdateInstallationConfirmed()
{
qDebug() << "Confirm update installation";
QPointer<FvAvailableUpdate> proposedUpdate = GetProposedUpdate();
QPointer<FvAvailableUpdate> const proposedUpdate = GetProposedUpdate();
if (proposedUpdate.isNull())
{
qWarning() << "Proposed update is NULL (shouldn't be at this point)";

View File

@ -60,7 +60,7 @@ FvUpdateWindow::~FvUpdateWindow()
//---------------------------------------------------------------------------------------------------------------------
auto FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate() -> bool
{
QPointer<FvAvailableUpdate> proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
QPointer<FvAvailableUpdate> const proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
if (proposedUpdate.isNull())
{
return false;

View File

@ -222,7 +222,7 @@ auto PenStylePic(QColor backgroundColor, QColor textColor, Qt::PenStyle style) -
QPixmap pix(80, 14);
pix.fill(backgroundColor);
QPen pen(textColor, 2.5, style);
QPen const pen(textColor, 2.5, style);
QPainter painter(&pix);
painter.setPen(pen);

View File

@ -50,7 +50,7 @@ auto IsMimeTypeImage(const QMimeType &mime) -> bool
QStringList aliases = mime.aliases();
aliases.prepend(mime.name());
static QRegularExpression rx(QStringLiteral("^image\\/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$"));
static QRegularExpression const rx(QStringLiteral("^image\\/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$"));
return std::any_of(aliases.begin(), aliases.end(), [](const QString &name) { return rx.match(name).hasMatch(); });
}
@ -78,11 +78,11 @@ auto MimeTypeFromByteArray(const QByteArray &data) -> QMimeType
QSet<QString> aliases = ConvertToSet<QString>(mime.aliases());
aliases.insert(mime.name());
QSet<QString> gzipMime{"application/gzip", "application/x-gzip"};
QSet<QString> const gzipMime{"application/gzip", "application/x-gzip"};
if (gzipMime.contains(aliases))
{
QSvgRenderer render(data);
QSvgRenderer const render(data);
if (render.isValid())
{
mime = QMimeDatabase().mimeTypeForName(QStringLiteral("image/svg+xml-compressed"));

View File

@ -108,7 +108,7 @@ void VAbstractConverter::ReserveFile() const
// It's not possible in all cases make conversion without lose data.
// For such cases we will store old version in a reserve file.
QString error;
QFileInfo info(m_convertedFileName);
QFileInfo const info(m_convertedFileName);
const QString reserveFileName = u"%1/%2(v%3).%4.bak"_s.arg(info.absoluteDir().absolutePath(), info.baseName(),
GetFormatVersionStr(), info.completeSuffix());
if (not SafeCopy(m_convertedFileName, reserveFileName, error))
@ -196,7 +196,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
const char *schemaData = data.constData();
const auto schemaSize = static_cast<size_t>(data.size());
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource(
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> const grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource(
reinterpret_cast<const XMLByte *>(schemaData), schemaSize, "schema"));
if (domParser.loadGrammar(*grammarSource, XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
@ -236,7 +236,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
const char *patternData = patternFileData.constData();
const auto patternSize = static_cast<size_t>(patternFileData.size());
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> patternSource(new XERCES_CPP_NAMESPACE::MemBufInputSource(
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> const patternSource(new XERCES_CPP_NAMESPACE::MemBufInputSource(
reinterpret_cast<const XMLByte *>(patternData), patternSize, "pattern"));
domParser.parse(*patternSource);
@ -375,7 +375,7 @@ void VAbstractConverter::SetVersion(const QString &version)
if (setTagText(TagVersion, version) == false)
{
VException e(tr("Could not change version."));
VException const e(tr("Could not change version."));
throw e;
}
}

View File

@ -214,7 +214,7 @@ auto GetTokens(const VFormulaField &formula) -> QList<QString>
{
try
{
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula.expression, false, false));
QScopedPointer<qmu::QmuTokenParser> const cal(new qmu::QmuTokenParser(formula.expression, false, false));
return cal->GetTokens().values();
}
catch (const qmu::QmuParserError &e)
@ -275,18 +275,18 @@ auto PrepareGroupTags(QStringList tags) -> QString
//---------------------------------------------------------------------------------------------------------------------
auto StringToTransfrom(const QString &matrix) -> QTransform
{
QStringList elements = matrix.split(';'_L1);
QStringList const elements = matrix.split(';'_L1);
if (elements.count() == 9)
{
qreal m11 = elements.at(0).toDouble();
qreal m12 = elements.at(1).toDouble();
qreal m13 = elements.at(2).toDouble();
qreal m21 = elements.at(3).toDouble();
qreal m22 = elements.at(4).toDouble();
qreal m23 = elements.at(5).toDouble();
qreal m31 = elements.at(6).toDouble();
qreal m32 = elements.at(7).toDouble();
qreal m33 = elements.at(8).toDouble();
qreal const m11 = elements.at(0).toDouble();
qreal const m12 = elements.at(1).toDouble();
qreal const m13 = elements.at(2).toDouble();
qreal const m21 = elements.at(3).toDouble();
qreal const m22 = elements.at(4).toDouble();
qreal const m23 = elements.at(5).toDouble();
qreal const m31 = elements.at(6).toDouble();
qreal const m32 = elements.at(7).toDouble();
qreal const m33 = elements.at(8).toDouble();
return {m11, m12, m13, m21, m22, m23, m31, m32, m33};
}
@ -303,7 +303,7 @@ template <class T> auto NumberToString(T number) -> QString
//---------------------------------------------------------------------------------------------------------------------
auto TransformToString(const QTransform &m) -> QString
{
QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
QStringList const matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()),
NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())};
return matrix.join(';'_L1);
@ -560,7 +560,7 @@ auto VAbstractPattern::GetPPElement(const QString &name) -> QDomElement
for (qint32 i = 0; i < elements.count(); i++)
{
QDomElement element = elements.at(i).toElement();
QDomElement const element = elements.at(i).toElement();
if (not element.isNull())
{
if (element.attribute(AttrName) == name)
@ -1166,7 +1166,7 @@ auto VAbstractPattern::GetLabelTimeFormat() const -> QString
return globalLabelTimeFormat;
}
QDomElement tag = list.at(0).toElement();
QDomElement const tag = list.at(0).toElement();
return GetParametrString(tag, AttrTimeFormat, globalLabelTimeFormat);
}
@ -1385,7 +1385,7 @@ auto VAbstractPattern::GetImage() const -> VPatternImage
const QDomNodeList list = elementsByTagName(TagImage);
if (not list.isEmpty())
{
QDomElement imgTag = list.at(0).toElement();
QDomElement const imgTag = list.at(0).toElement();
if (not imgTag.isNull())
{
image.SetContentData(imgTag.text().toLatin1(), imgTag.attribute(AttrContentType));
@ -1425,7 +1425,7 @@ auto VAbstractPattern::GetBackgroundImages() const -> QVector<VBackgroundPattern
return images;
}
QDomElement imagesTag = list.at(0).toElement();
QDomElement const imagesTag = list.at(0).toElement();
if (not imagesTag.isNull())
{
QDomNode imageNode = imagesTag.firstChild();
@ -1515,7 +1515,7 @@ void VAbstractPattern::DeleteBackgroundImage(const QUuid &id)
const QDomElement imageElement = imageNode.toElement();
if (not imageElement.isNull())
{
QUuid imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId));
QUuid const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId));
if (imageId == id)
{
imagesTag.removeChild(imageElement);
@ -1738,7 +1738,7 @@ auto VAbstractPattern::GetIndexActivPP() const -> int
{
for (int i = 0; i < drawList.size(); ++i)
{
QDomElement node = drawList.at(i).toElement();
QDomElement const node = drawList.at(i).toElement();
if (node.attribute(AttrName) == nameActivPP)
{
index = i;
@ -2231,7 +2231,7 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con
{
VBackgroundPatternImage image;
image.SetId(QUuid(GetParametrEmptyString(element, AttrImageId)));
QString path = GetParametrEmptyString(element, AttrPath);
QString const path = GetParametrEmptyString(element, AttrPath);
if (not path.isEmpty())
{
@ -2239,8 +2239,8 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con
}
else
{
QString contentType = GetParametrEmptyString(element, AttrContentType);
QByteArray contentData = element.text().toLatin1();
QString const contentType = GetParametrEmptyString(element, AttrContentType);
QByteArray const contentData = element.text().toLatin1();
image.SetContentData(contentData, contentType);
}
@ -2253,7 +2253,7 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con
image.SetOpacity(
GetParametrDouble(element, AttrOpacity, QString::number(settings->GetBackgroundImageDefOpacity() / 100.)));
QString matrix = GetParametrEmptyString(element, AttrTransform);
QString const matrix = GetParametrEmptyString(element, AttrTransform);
image.SetMatrix(StringToTransfrom(matrix));
return image;
@ -2265,7 +2265,7 @@ auto VAbstractPattern::GetBackgroundImageElement(const QUuid &id) const -> QDomE
const QDomNodeList list = elementsByTagName(TagBackgroundImages);
if (not list.isEmpty())
{
QDomElement imagesTag = list.at(0).toElement();
QDomElement const imagesTag = list.at(0).toElement();
if (not imagesTag.isNull())
{
QDomNode imageNode = imagesTag.firstChild();
@ -2276,7 +2276,7 @@ auto VAbstractPattern::GetBackgroundImageElement(const QUuid &id) const -> QDomE
const QDomElement imageElement = imageNode.toElement();
if (not imageElement.isNull())
{
QUuid imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId));
QUuid const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId));
if (imageId == id)
{
return imageElement;
@ -2345,7 +2345,7 @@ auto VAbstractPattern::GetDraw(const QString &name) const -> QDomElement
const QDomNodeList draws = documentElement().elementsByTagName(TagDraw);
for (int i = 0; i < draws.size(); ++i)
{
QDomElement draw = draws.at(i).toElement();
QDomElement const draw = draws.at(i).toElement();
if (draw.isNull())
{
continue;
@ -2448,7 +2448,7 @@ auto VAbstractPattern::GroupLinkedToTool(vidtype toolId) const -> vidtype
auto VAbstractPattern::GetGroupName(quint32 id) -> QString
{
QString name = QCoreApplication::translate("VAbstractPattern", "New group");
QDomElement group = elementById(id, TagGroup);
QDomElement const group = elementById(id, TagGroup);
if (group.isElement())
{
name = GetParametrString(group, AttrName, name);
@ -2473,7 +2473,7 @@ void VAbstractPattern::SetGroupName(quint32 id, const QString &name)
auto VAbstractPattern::GetGroupTags(vidtype id) -> QStringList
{
QStringList tags;
QDomElement group = elementById(id, TagGroup);
QDomElement const group = elementById(id, TagGroup);
if (group.isElement())
{
tags = FilterGroupTags(GetParametrEmptyString(group, AttrTags));
@ -2498,7 +2498,7 @@ void VAbstractPattern::SetGroupTags(quint32 id, const QStringList &tags)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::GetDimensionAValue() -> double
{
QDomElement domElement = UniqueTag(TagMeasurements);
QDomElement const domElement = UniqueTag(TagMeasurements);
if (not domElement.isNull())
{
return GetParametrDouble(domElement, AttrDimensionA, *dimensionDefValue);
@ -2527,7 +2527,7 @@ void VAbstractPattern::SetDimensionAValue(double value)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::GetDimensionBValue() -> double
{
QDomElement domElement = UniqueTag(TagMeasurements);
QDomElement const domElement = UniqueTag(TagMeasurements);
if (not domElement.isNull())
{
return GetParametrDouble(domElement, AttrDimensionB, *dimensionDefValue);
@ -2556,7 +2556,7 @@ void VAbstractPattern::SetDimensionBValue(double value)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::GetDimensionCValue() -> double
{
QDomElement domElement = UniqueTag(TagMeasurements);
QDomElement const domElement = UniqueTag(TagMeasurements);
if (not domElement.isNull())
{
return GetParametrDouble(domElement, AttrDimensionC, *dimensionDefValue);
@ -2593,7 +2593,7 @@ auto VAbstractPattern::GetGroupCategories() const -> QStringList
const QDomElement group = groups.at(i).toElement();
if (not group.isNull() && group.hasAttribute(AttrTags))
{
QStringList groupTags = VAbstractPattern::FilterGroupTags(GetParametrEmptyString(group, AttrTags));
QStringList const groupTags = VAbstractPattern::FilterGroupTags(GetParametrEmptyString(group, AttrTags));
categories.unite(ConvertToSet<QString>(groupTags));
}
}
@ -2608,7 +2608,7 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
try
{
QDomElement groups = CreateGroups(patternPieceName);
QDomElement const groups = CreateGroups(patternPieceName);
if (not groups.isNull())
{
QDomNode domNode = groups.firstChild();
@ -2687,7 +2687,7 @@ auto VAbstractPattern::GetGroupsContainingItem(quint32 toolId, quint32 objectId,
// TODO : order in alphabetical order
QDomElement groups = CreateGroups();
QDomElement const groups = CreateGroups();
if (not groups.isNull())
{
QDomNode domNode = groups.firstChild();
@ -2700,7 +2700,7 @@ auto VAbstractPattern::GetGroupsContainingItem(quint32 toolId, quint32 objectId,
{
if (group.tagName() == TagGroup)
{
bool groupHasItem = GroupHasItem(group, toolId, objectId);
bool const groupHasItem = GroupHasItem(group, toolId, objectId);
if ((containItem && groupHasItem) || (not containItem && not groupHasItem))
{
const quint32 groupId = GetParametrUInt(group, AttrId, QChar('0'));
@ -2741,8 +2741,8 @@ auto VAbstractPattern::GroupHasItem(const QDomElement &groupDomElement, quint32
const QDomElement item = itemNode.toElement();
if (item.isNull() == false)
{
quint32 toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0'));
quint32 objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));
quint32 const toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0'));
quint32 const objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));
if (toolIdIterate == toolId && objectIdIterate == objectId)
{
@ -2808,7 +2808,7 @@ auto VAbstractPattern::ReadPatternName() const -> QString
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::ReadMPath() const -> QString
{
QDomElement domElement = UniqueTag(TagMeasurements);
QDomElement const domElement = UniqueTag(TagMeasurements);
if (not domElement.isNull())
{
return domElement.attribute(AttrPath);
@ -2862,7 +2862,7 @@ auto VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32
emit UpdateGroups();
// parse the groups to update the drawing, in case the item was added to an invisible group
QDomElement groups = CreateGroups();
QDomElement const groups = CreateGroups();
if (not groups.isNull())
{
ParseGroups(groups);
@ -2902,8 +2902,8 @@ auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui
const QDomElement item = itemNode.toElement();
if (not item.isNull())
{
quint32 toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0'));
quint32 objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));
quint32 const toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0'));
quint32 const objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));
if (toolIdIterate == toolId && objectIdIterate == objectId)
{
@ -2917,7 +2917,7 @@ auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui
emit UpdateGroups();
// parse the groups to update the drawing, in case the item was removed from an invisible group
QDomElement groups = CreateGroups();
QDomElement const groups = CreateGroups();
if (not groups.isNull())
{
ParseGroups(groups);
@ -2941,7 +2941,7 @@ auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::GetGroupVisibility(quint32 id) -> bool
{
QDomElement group = elementById(id, TagGroup);
QDomElement const group = elementById(id, TagGroup);
if (group.isElement())
{
return GetParametrBool(group, AttrVisible, trueStr);

View File

@ -85,7 +85,7 @@ auto VBackgroundPatternImage::FromFile(const QString &fileName, bool builtIn) ->
QT_WARNING_POP
QMimeType mime = QMimeDatabase().mimeTypeForFile(fileName);
QMimeType const mime = QMimeDatabase().mimeTypeForFile(fileName);
if (not IsMimeTypeImage(mime))
{
@ -102,7 +102,7 @@ auto VBackgroundPatternImage::FromFile(const QString &fileName, bool builtIn) ->
return {};
}
QString base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1);
QString const base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1);
image.SetContentData(base64.toLatin1(), mime.name());
}
else
@ -159,7 +159,7 @@ auto VBackgroundPatternImage::IsValid() const -> bool
if (not m_filePath.isEmpty())
{
QMimeType mime = MimeTypeFromData();
QMimeType const mime = MimeTypeFromData();
if (not IsMimeTypeImage(mime))
{
@ -175,7 +175,7 @@ auto VBackgroundPatternImage::IsValid() const -> bool
return false;
}
QMimeType mime = MimeTypeFromData();
QMimeType const mime = MimeTypeFromData();
QSet<QString> aliases = ConvertToSet<QString>(mime.aliases());
aliases.insert(mime.name());
@ -326,7 +326,7 @@ auto VBackgroundPatternImage::Type() const -> PatternImage
return PatternImage::Unknown;
}
QMimeType mime = MimeTypeFromData();
QMimeType const mime = MimeTypeFromData();
if (mime.name().startsWith(QStringLiteral("image/svg+xml")))
{
@ -339,8 +339,8 @@ auto VBackgroundPatternImage::Type() const -> PatternImage
//---------------------------------------------------------------------------------------------------------------------
auto VBackgroundPatternImage::BoundingRect() const -> QRectF
{
QSize imageSize = Size();
QRectF imageRect({0, 0}, QSizeF(imageSize.width(), imageSize.height()));
QSize const imageSize = Size();
QRectF const imageRect({0, 0}, QSizeF(imageSize.width(), imageSize.height()));
return m_matrix.mapRect(imageRect);
}
@ -379,7 +379,7 @@ auto VBackgroundPatternImage::LinkedImageSize() const -> QSize
if (Type() == PatternImage::Vector)
{
QSvgRenderer renderer(m_filePath);
QSvgRenderer const renderer(m_filePath);
return not renderer.isValid() ? ScaleVectorImage(QSvgRenderer(brokenImage)) : ScaleVectorImage(renderer);
}
@ -402,7 +402,7 @@ auto VBackgroundPatternImage::BuiltInImageSize() const -> QSize
if (Type() == PatternImage::Vector)
{
QSvgRenderer renderer(array);
QSvgRenderer const renderer(array);
return not renderer.isValid() ? ScaleVectorImage(QSvgRenderer(brokenImage)) : ScaleVectorImage(renderer);
}

View File

@ -137,7 +137,7 @@ void SaveNodeCanonically(QXmlStreamWriter &stream, const QDomNode &domNode)
//---------------------------------------------------------------------------------------------------------------------
auto GetChildElements(const QDomNode &e) -> QList<QDomNode>
{
QDomNodeList children = e.childNodes();
QDomNodeList const children = e.childNodes();
QList<QDomNode> r;
r.reserve(children.size());
for (int k = 0; k < children.size(); ++k)
@ -150,7 +150,7 @@ auto GetChildElements(const QDomNode &e) -> QList<QDomNode>
//---------------------------------------------------------------------------------------------------------------------
auto GetElementAttributes(const QDomNode &e) -> QList<QDomNode>
{
QDomNamedNodeMap attributes = e.attributes();
QDomNamedNodeMap const attributes = e.attributes();
QList<QDomNode> r;
r.reserve(attributes.size());
for (int k = 0; k < attributes.size(); ++k)
@ -168,8 +168,8 @@ auto LessThen(const QDomNode &element1, const QDomNode &element2) -> bool
return element1.nodeType() < element2.nodeType();
}
QString tag1 = element1.nodeName();
QString tag2 = element2.nodeName();
QString const tag1 = element1.nodeName();
QString const tag2 = element2.nodeName();
// qDebug() << tag1 <<tag2;
if (tag1 != tag2)
@ -178,8 +178,8 @@ auto LessThen(const QDomNode &element1, const QDomNode &element2) -> bool
}
// Compare attributes
QList<QDomNode> attributes1 = GetElementAttributes(element1);
QList<QDomNode> attributes2 = GetElementAttributes(element2);
QList<QDomNode> const attributes1 = GetElementAttributes(element1);
QList<QDomNode> const attributes2 = GetElementAttributes(element2);
if (attributes1.size() != attributes2.size())
{
@ -221,10 +221,11 @@ auto LessThen(const QDomNode &element1, const QDomNode &element2) -> bool
}
// Compare children
QList<QDomNode> elts1 = GetChildElements(element1);
QList<QDomNode> elts2 = GetChildElements(element2);
QList<QDomNode> const elts1 = GetChildElements(element1);
QList<QDomNode> const elts2 = GetChildElements(element2);
QString value1, value2;
QString value1;
QString value2;
if (elts1.size() != elts2.size())
{
@ -660,7 +661,7 @@ auto VDomDocument::GetParametrId(const QDomElement &domElement) -> quint32
//---------------------------------------------------------------------------------------------------------------------
auto VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const -> QString
{
QDomElement domElement = UniqueTag(tagName);
QDomElement const domElement = UniqueTag(tagName);
if (not domElement.isNull())
{
const QString text = domElement.text();
@ -720,7 +721,7 @@ void VDomDocument::RefreshElementIdCache()
//---------------------------------------------------------------------------------------------------------------------
auto VDomDocument::Compare(const QDomElement &element1, const QDomElement &element2) -> bool
{
QFuture<bool> lessThen2 = QtConcurrent::run(LessThen, element2, element1);
QFuture<bool> const lessThen2 = QtConcurrent::run(LessThen, element2, element1);
return !LessThen(element1, element2) && !lessThen2.result();
}
@ -809,8 +810,8 @@ auto VDomDocument::SaveDocument(const QString &fileName, QString &error) -> bool
if (success)
{
// https://stackoverflow.com/questions/74051505/does-qsavefilecommit-fsync-the-file-to-the-filesystem
QString directoryPath = QFileInfo(file.fileName()).absoluteDir().path();
int dirFd = ::open(directoryPath.toLocal8Bit().data(), O_RDONLY | O_DIRECTORY);
QString const directoryPath = QFileInfo(file.fileName()).absoluteDir().path();
int const dirFd = ::open(directoryPath.toLocal8Bit().data(), O_RDONLY | O_DIRECTORY);
if (dirFd != -1)
{
::fsync(dirFd);
@ -832,8 +833,8 @@ auto VDomDocument::SaveDocument(const QString &fileName, QString &error) -> bool
// cppcheck-suppress unusedFunction
auto VDomDocument::Major() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0"_L1);
QStringList v = version.split('.'_L1);
QString const version = UniqueTagText(TagVersion, "0.0.0"_L1);
QStringList const v = version.split('.'_L1);
return v.at(0);
}
@ -841,8 +842,8 @@ auto VDomDocument::Major() const -> QString
// cppcheck-suppress unusedFunction
auto VDomDocument::Minor() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0"_L1);
QStringList v = version.split('.'_L1);
QString const version = UniqueTagText(TagVersion, "0.0.0"_L1);
QStringList const v = version.split('.'_L1);
return v.at(1);
}
@ -850,8 +851,8 @@ auto VDomDocument::Minor() const -> QString
// cppcheck-suppress unusedFunction
auto VDomDocument::Patch() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0"_L1);
QStringList v = version.split('.'_L1);
QString const version = UniqueTagText(TagVersion, "0.0.0"_L1);
QStringList const v = version.split('.'_L1);
return v.at(2);
}
@ -924,7 +925,7 @@ auto VDomDocument::setTagText(const QString &tag, const QString &text) -> bool
}
else
{
QDomNode domNode = nodeList.at(0);
QDomNode const domNode = nodeList.at(0);
if (not domNode.isNull() && domNode.isElement())
{
QDomElement domElement = domNode.toElement();
@ -939,7 +940,7 @@ auto VDomDocument::setTagText(QDomElement &domElement, const QString &text) -> b
{
if (not domElement.isNull())
{
QDomNode oldText = domElement.firstChild();
QDomNode const oldText = domElement.firstChild();
const QDomText newText = createTextNode(text);
if (oldText.isNull())
@ -1004,21 +1005,21 @@ void VDomDocument::RemoveAllChildren(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
auto VDomDocument::ParentNodeById(const quint32 &nodeId) -> QDomNode
{
QDomElement domElement = NodeById(nodeId);
QDomElement const domElement = NodeById(nodeId);
return domElement.parentNode();
}
//---------------------------------------------------------------------------------------------------------------------
auto VDomDocument::CloneNodeById(const quint32 &nodeId) -> QDomElement
{
QDomElement domElement = NodeById(nodeId);
QDomElement const domElement = NodeById(nodeId);
return domElement.cloneNode().toElement();
}
//---------------------------------------------------------------------------------------------------------------------
auto VDomDocument::NodeById(const quint32 &nodeId, const QString &tagName) -> QDomElement
{
QDomElement domElement = elementById(nodeId, tagName);
QDomElement const domElement = elementById(nodeId, tagName);
if (domElement.isNull() || domElement.isElement() == false)
{
throw VExceptionBadId(tr("Couldn't get node"), nodeId);

View File

@ -61,7 +61,7 @@ VKnownMeasurementsConverter::VKnownMeasurementsConverter(const QString &fileName
//---------------------------------------------------------------------------------------------------------------------
auto VKnownMeasurementsConverter::GetFormatVersionStr() const -> QString
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
const QDomElement layoutElement = root.toElement();

View File

@ -86,7 +86,7 @@ const QChar pointsSep = ' '_L1;
//---------------------------------------------------------------------------------------------------------------------
auto StringV0_1_2ToPoint(const QString &point) -> QPointF
{
QStringList coordinates = point.split(coordintatesSep);
QStringList const coordinates = point.split(coordintatesSep);
if (coordinates.count() == 2)
{
return {coordinates.at(0).toDouble(), coordinates.at(1).toDouble()};
@ -99,7 +99,7 @@ auto StringV0_1_2ToPoint(const QString &point) -> QPointF
auto StringV0_1_2ToPath(const QString &path) -> QVector<QPointF>
{
QVector<QPointF> p;
QStringList points = path.split(pointsSep);
QStringList const points = path.split(pointsSep);
p.reserve(points.size());
for (const auto &point : points)
{
@ -128,7 +128,7 @@ VLayoutConverter::VLayoutConverter(const QString &fileName)
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutConverter::GetFormatVersionStr() const -> QString
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
const QDomElement layoutElement = root.toElement();
@ -232,7 +232,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_3()
for (const auto &tagType : types)
{
QDomNodeList tags = elementsByTagName(tagType);
QDomNodeList const tags = elementsByTagName(tagType);
for (int i = 0; i < tags.size(); ++i)
{
QDomElement node = tags.at(i).toElement();
@ -240,14 +240,14 @@ void VLayoutConverter::ConvertPiecesToV0_1_3()
}
}
QDomNodeList tags = elementsByTagName(*strMarkerTag);
QDomNodeList const tags = elementsByTagName(*strMarkerTag);
for (int i = 0; i < tags.size(); ++i)
{
QDomElement node = tags.at(i).toElement();
RemoveAllChildren(node);
}
QDomNodeList pieceTags = elementsByTagName(*strPieceTag);
QDomNodeList const pieceTags = elementsByTagName(*strPieceTag);
for (int i = 0; i < pieceTags.size(); ++i)
{
QDomElement node = pieceTags.at(i).toElement();
@ -262,7 +262,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_3()
//---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::ConvertPathToV0_1_3(QDomElement &node)
{
QString oldPath = node.text();
QString const oldPath = node.text();
if (oldPath.isEmpty())
{
return;
@ -298,7 +298,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
// TODO. Delete if minimal supported version is 0.1.5
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 5), "Time to refactor the code.");
QDomNodeList grainlineTags = elementsByTagName(*strGrainlineTag);
QDomNodeList const grainlineTags = elementsByTagName(*strGrainlineTag);
for (int i = 0; i < grainlineTags.size(); ++i)
{
QDomElement node = grainlineTags.at(i).toElement();
@ -313,7 +313,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
// convert arrowDirection
if (node.hasAttribute(*strAttrArrowDirection))
{
QString arrowDirection = node.attribute(*strAttrArrowDirection);
QString const arrowDirection = node.attribute(*strAttrArrowDirection);
const QStringList arrows{
"atFront", // 0
@ -392,7 +392,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_7()
// TODO. Delete if minimal supported version is 0.1.7
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 7), "Time to refactor the code.");
QDomNodeList pieceTags = elementsByTagName(*strPieceTag);
QDomNodeList const pieceTags = elementsByTagName(*strPieceTag);
for (int i = 0; i < pieceTags.size(); ++i)
{
QDomElement node = pieceTags.at(i).toElement();

View File

@ -1142,7 +1142,7 @@ auto VPatternConverter::TagMeasurementsV0_1_4() const -> QDomElement
const QDomElement element = list.at(0).toElement();
if (not element.isElement())
{
VException excep("Can't get tag measurements.");
VException const excep("Can't get tag measurements.");
throw excep;
}
return element;
@ -1158,7 +1158,7 @@ auto VPatternConverter::TagIncrementsV0_1_4() const -> QDomElement
const QDomElement element = list.at(0).toElement();
if (not element.isElement())
{
VException excep("Can't get tag measurements.");
VException const excep("Can't get tag measurements.");
throw excep;
}
return element;
@ -1170,7 +1170,7 @@ void VPatternConverter::FixToolUnionToV0_2_4()
// TODO. Delete if minimal supported version is 0.2.4
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code.");
QDomElement root = documentElement();
QDomElement const root = documentElement();
const QDomNodeList modelings = root.elementsByTagName(*strModeling);
for (int i = 0; i < modelings.size(); ++i)
{
@ -1440,7 +1440,7 @@ void VPatternConverter::FixCutPoint()
const QDomNodeList list = elementsByTagName(*strPoint);
for (int i = 0; i < list.size(); ++i)
{
QDomElement element = list.at(i).toElement();
QDomElement const element = list.at(i).toElement();
if (not element.isNull())
{
const QString type = element.attribute(*strType);
@ -1449,21 +1449,21 @@ void VPatternConverter::FixCutPoint()
case 0: // strCutSplinePath
{
const quint32 id = element.attribute(*strId).toUInt();
quint32 curve = element.attribute(*strSplinePath).toUInt();
quint32 const curve = element.attribute(*strSplinePath).toUInt();
FixSubPaths(i, id, curve);
break;
}
case 1: // strCutSpline
{
const quint32 id = element.attribute(*strId).toUInt();
quint32 curve = element.attribute(*strSpline).toUInt();
quint32 const curve = element.attribute(*strSpline).toUInt();
FixSubPaths(i, id, curve);
break;
}
case 2: // strCutArc
{
const quint32 id = element.attribute(*strId).toUInt();
quint32 curve = element.attribute(*strArc).toUInt();
quint32 const curve = element.attribute(*strArc).toUInt();
FixSubPaths(i, id, curve);
break;
}
@ -1617,7 +1617,7 @@ void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0()
const QDomNodeList list = elementsByTagName(*strModeling);
for (int i = 0; i < list.size(); ++i)
{
QDomElement modeling = list.at(i).toElement();
QDomElement const modeling = list.at(i).toElement();
if (not modeling.isNull())
{
QDomNode domNode = modeling.firstChild();
@ -1767,7 +1767,7 @@ auto VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail) -
const QDomElement node = childList.at(i).toElement();
if (not node.isNull())
{
QDomElement tagNode = node.cloneNode().toElement();
QDomElement const tagNode = node.cloneNode().toElement();
tagNodes.appendChild(tagNode);
}
}
@ -1805,7 +1805,7 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName)
{
if (dom.hasAttribute(attribute))
{
QString valStr = dom.attribute(attribute, QChar('1'));
QString const valStr = dom.attribute(attribute, QChar('1'));
bool ok = false;
qreal val = valStr.toDouble(&ok);
if (not ok)
@ -1842,7 +1842,7 @@ auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement
<< *strGradation << *strPatternName << *strPatternNum << *strCompanyName
<< *strCustomerName << *strPatternLabel;
QDomElement element = createElement(*strPatternLabel);
QDomElement const element = createElement(*strPatternLabel);
QDomElement pattern = documentElement();
for (vsizetype i = tags.indexOf(element.tagName()) - 1; i >= 0; --i)
{
@ -1937,7 +1937,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0()
for (int i = 0; i < nodeList.size(); ++i)
{
QDomElement dataTag = nodeList.at(i).toElement();
QDomNodeList nodeListMCP = dataTag.childNodes();
QDomNodeList const nodeListMCP = dataTag.childNodes();
const int count = nodeListMCP.count();
try
{
@ -1957,7 +1957,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0()
for (int iMCP = 0; iMCP < count; ++iMCP)
{
QDomElement domMCP = nodeListMCP.at(iMCP).toElement();
QDomElement const domMCP = nodeListMCP.at(iMCP).toElement();
QString line;
@ -2026,7 +2026,7 @@ void VPatternConverter::RemoveUnusedTagsV0_6_0()
RemoveUniqueTagV0_6_0(*strShowDate);
RemoveUniqueTagV0_6_0(*strShowMeasurements);
QDomNodeList nodeList = elementsByTagName(*strData);
QDomNodeList const nodeList = elementsByTagName(*strData);
for (int i = 0; i < nodeList.size(); ++i)
{
QDomElement child = nodeList.at(i).firstChildElement(*strMCP);
@ -2074,7 +2074,7 @@ void VPatternConverter::RemoveGradationV0_8_8()
QDomElement patternElement = documentElement();
if (patternElement.isElement())
{
QDomElement gradationTag = patternElement.firstChildElement(*strGradation);
QDomElement const gradationTag = patternElement.firstChildElement(*strGradation);
if (gradationTag.isElement())
{
patternElement.removeChild(gradationTag);
@ -2112,12 +2112,13 @@ void VPatternConverter::ConvertImageToV0_9_0()
QDomElement img = list.at(0).toElement();
if (not img.isNull())
{
QString extension = img.attribute(*strExtension);
QString const extension = img.attribute(*strExtension);
img.removeAttribute(*strExtension);
if (not extension.isEmpty())
{
QMap<QString, QString> mimeTypes{{"BMP", "image/bmp"}, {"JPG", "image/jpeg"}, {"PNG", "image/png"}};
QMap<QString, QString> const mimeTypes{
{"BMP", "image/bmp"}, {"JPG", "image/jpeg"}, {"PNG", "image/png"}};
if (mimeTypes.contains(extension))
{
@ -2143,7 +2144,7 @@ void VPatternConverter::ConvertImageToV0_9_0()
return list;
};
QStringList data = SplitString();
QStringList const data = SplitString();
setTagText(img, data.join("\n"));
}
}

View File

@ -53,7 +53,7 @@ using namespace Qt::Literals::StringLiterals;
auto VPatternImage::FromFile(const QString &fileName) -> VPatternImage
{
VPatternImage image;
QMimeType mime = QMimeDatabase().mimeTypeForFile(fileName);
QMimeType const mime = QMimeDatabase().mimeTypeForFile(fileName);
if (not IsMimeTypeImage(mime))
{
@ -68,7 +68,7 @@ auto VPatternImage::FromFile(const QString &fileName) -> VPatternImage
return {};
}
QString base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1);
QString const base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1);
image.SetContentData(base64.toLatin1(), mime.name());
return image;
@ -116,7 +116,7 @@ auto VPatternImage::IsValid() const -> bool
return false;
}
QMimeType mime = MimeTypeFromData();
QMimeType const mime = MimeTypeFromData();
QSet<QString> aliases = ConvertToSet<QString>(mime.aliases());
aliases.insert(mime.name());
@ -148,7 +148,7 @@ auto VPatternImage::GetPixmap() const -> QPixmap
buffer.open(QIODevice::ReadOnly);
QImageReader imageReader(&buffer);
QImage image = imageReader.read();
QImage const image = imageReader.read();
if (image.isNull())
{
qCritical() << tr("Couldn't read the image. Error: %1").arg(imageReader.errorString());
@ -179,7 +179,7 @@ auto VPatternImage::GetPixmap(const QSize &size) const -> QPixmap
QImageReader imageReader(&buffer);
imageReader.setScaledSize(size);
QImage image = imageReader.read();
QImage const image = imageReader.read();
if (image.isNull())
{
qCritical() << tr("Couldn't read the image. Error: %1").arg(imageReader.errorString());

View File

@ -256,7 +256,7 @@ void VVITConverter::GenderV0_3_1()
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 1), "Time to refactor the code.");
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("sex"));
QDomElement sex = nodeList.at(0).toElement();
QDomElement const sex = nodeList.at(0).toElement();
QDomElement parent = sex.parentNode().toElement();
parent.replaceChild(CreateElementWithText(QStringLiteral("gender"), sex.text()), sex);
}
@ -268,7 +268,7 @@ void VVITConverter::PM_SystemV0_3_2()
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 2), "Time to refactor the code.");
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("personal"));
QDomElement personal = nodeList.at(0).toElement();
QDomElement const personal = nodeList.at(0).toElement();
QDomElement parent = personal.parentNode().toElement();
parent.insertBefore(CreateElementWithText(QStringLiteral("pm_system"), QStringLiteral("998")), personal);
@ -323,7 +323,7 @@ void VVITConverter::ConvertCustomerNameToV0_4_0()
const QDomNodeList givenNameList = this->elementsByTagName(*strGivenName);
if (not givenNameList.isEmpty())
{
QDomNode givenNameNode = givenNameList.at(0);
QDomNode const givenNameNode = givenNameList.at(0);
givenName = givenNameNode.toElement().text();
personal.removeChild(givenNameNode);
}
@ -333,7 +333,7 @@ void VVITConverter::ConvertCustomerNameToV0_4_0()
const QDomNodeList familyNameList = this->elementsByTagName(*strFamilyName);
if (not familyNameList.isEmpty())
{
QDomNode familyNameNode = familyNameList.at(0);
QDomNode const familyNameNode = familyNameList.at(0);
familyName = familyNameNode.toElement().text();
personal.removeChild(familyNameNode);
}

View File

@ -236,7 +236,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
continue;
}
QDomElement m = nodeList.at(0).toElement();
QDomElement const m = nodeList.at(0).toElement();
const qreal value = GetParametrDouble(m, QStringLiteral("value"), QStringLiteral("0.0"));
const qreal size_increase = GetParametrDouble(m, QStringLiteral("size_increase"), QStringLiteral("0.0"));
const qreal height_increase =
@ -284,7 +284,7 @@ void VVSTConverter::PM_SystemV0_4_1()
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 1), "Time to refactor the code.");
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("size"));
QDomElement personal = nodeList.at(0).toElement();
QDomElement const personal = nodeList.at(0).toElement();
QDomElement parent = personal.parentNode().toElement();
parent.insertBefore(CreateElementWithText(QStringLiteral("pm_system"), QStringLiteral("998")), personal);
@ -434,7 +434,7 @@ void VVSTConverter::ConvertCircumferenceAttreibuteToV0_5_4()
QDomElement dom = list.at(i).toElement();
if (dom.hasAttribute(*strAttrCircumference))
{
bool m = GetParametrBool(dom, *strAttrCircumference, trueStr);
bool const m = GetParametrBool(dom, *strAttrCircumference, trueStr);
dom.removeAttribute(*strAttrCircumference);
SetAttribute(dom, *strAttrMeasurement, m);
}

View File

@ -180,7 +180,7 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC
Q_UNUSED(decimalPoint)
Q_UNUSED(groupSeparator)
QSet<QChar> reserved{positiveSign, negativeSign, sign0, sign1, sign2, sign3, sign4,
QSet<QChar> const reserved{positiveSign, negativeSign, sign0, sign1, sign2, sign3, sign4,
sign5, sign6, sign7, sign8, sign9, expUpper, expLower};
if (reserved.contains(decimal) || reserved.contains(thousand))
@ -190,7 +190,7 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC
}
// row - current state, column - new state
static uchar table[9][6] = {
static uchar const table[9][6] = {
/* None InputSign InputThousand InputDigit InputDot InputExp */
{
0,

View File

@ -67,13 +67,13 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
tmp.setAngle(tmp.angle() + 90.0 * sign);
tmp.setLength(split);
QPointF p1 = tmp.p2();
QPointF const p1 = tmp.p2();
tmp = QLineF(QPointF(0, length), QPointF(0, 0));
tmp.setAngle(tmp.angle() - 90.0 * sign);
tmp.setLength(split);
QPointF p2 = tmp.p2();
QPointF const p2 = tmp.p2();
const QLineF line2(p1, p2);
@ -109,7 +109,7 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
return 0;
}
QLineF radius(crosPoint, tmp.p2());
QLineF const radius(crosPoint, tmp.p2());
const qreal arcAngle = sign > 0 ? line.angleTo(radius) : radius.angleTo(line);
arcL = (M_PI * radius.length()) / 180.0 * arcAngle;
} while (qAbs(arcL - arcLength) > (0.5 /*mm*/ / 25.4) * PrintDPI);
@ -385,7 +385,7 @@ auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVa
{
qreal fVal(0);
qmusizetype pos =
qmusizetype const pos =
ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal, thousand);
if (pos == -1)

View File

@ -429,7 +429,7 @@ void QmuParserBase::CheckName(const QString &a_sName, const QString &a_szCharSet
void QmuParserBase::SetExpr(const QString &a_sExpr)
{
// Check locale compatibility
std::locale loc;
std::locale const loc;
if (m_pTokenReader->GetArgSep() == QChar(std::use_facet<std::numpunct<char_type>>(loc).decimal_point()))
{
Error(ecLOCALE);
@ -440,7 +440,7 @@ void QmuParserBase::SetExpr(const QString &a_sExpr)
// when calling tellg on a stringstream created from the expression after
// reading a value at the end of an expression. (qmu::QmuParser::IsVal function)
// (tellg returns -1 otherwise causing the parser to ignore the value)
QString sBuf(a_sExpr + QChar(' '));
QString const sBuf(a_sExpr + QChar(' '));
m_pTokenReader->SetFormula(sBuf);
ReInit();
}
@ -790,20 +790,20 @@ void QmuParserBase::ApplyFunc(QStack<token_type> &a_stOpt, QStack<token_type> &a
return;
}
token_type funTok = a_stOpt.pop();
token_type const funTok = a_stOpt.pop();
assert(funTok.GetFuncAddr());
// Binary operators must rely on their internal operator number
// since counting of operators relies on commas for function arguments
// binary operators do not have commas in their expression
int iArgCount = (funTok.GetCode() == cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount;
int const iArgCount = (funTok.GetCode() == cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount;
// determine how many parameters the function needs. To remember iArgCount includes the
// string parameter whilst GetArgCount() counts only numeric parameters.
int iArgRequired = funTok.GetArgCount() + ((funTok.GetType() == tpSTR) ? 1 : 0);
int const iArgRequired = funTok.GetArgCount() + ((funTok.GetType() == tpSTR) ? 1 : 0);
// Thats the number of numerical parameters
int iArgNumerical = iArgCount - ((funTok.GetType() == tpSTR) ? 1 : 0);
int const iArgNumerical = iArgCount - ((funTok.GetType() == tpSTR) ? 1 : 0);
if (funTok.GetCode() == cmFUNC_STR && iArgCount - iArgNumerical > 1)
{
@ -882,23 +882,23 @@ void QmuParserBase::ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type>
// Check if there is an if Else clause to be calculated
while (a_stOpt.size() && a_stOpt.top().GetCode() == cmELSE)
{
token_type opElse = a_stOpt.pop();
token_type const opElse = a_stOpt.pop();
Q_ASSERT(a_stOpt.size() > 0);
// Take the value associated with the else branch from the value stack
token_type vVal2 = a_stVal.pop();
token_type const vVal2 = a_stVal.pop();
Q_ASSERT(a_stOpt.size() > 0);
Q_ASSERT(a_stVal.size() >= 2);
// it then else is a ternary operator Pop all three values from the value s
// tack and just return the right value
token_type vVal1 = a_stVal.pop();
token_type vExpr = a_stVal.pop();
token_type const vVal1 = a_stVal.pop();
token_type const vExpr = a_stVal.pop();
a_stVal.push(not qFuzzyIsNull(vExpr.GetVal()) ? vVal1 : vVal2);
token_type opIf = a_stOpt.pop();
token_type const opIf = a_stOpt.pop();
Q_ASSERT(opElse.GetCode() == cmELSE);
Q_ASSERT(opIf.GetCode() == cmIF);
@ -1131,7 +1131,7 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal
// Next is treatment of numeric functions
case cmFUNC:
{
qmusizetype iArgCount = pTok->Fun.argc;
qmusizetype const iArgCount = pTok->Fun.argc;
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wcast-function-type")
@ -1214,7 +1214,7 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal
sidx -= pTok->Fun.argc - 1;
// The index of the string argument in the string table
qmusizetype iIdxStack = pTok->Fun.idx;
qmusizetype const iIdxStack = pTok->Fun.idx;
Q_ASSERT(iIdxStack >= 0 && iIdxStack < m_vStringBuf.size());
switch (pTok->Fun.argc) // switch according to argument count
@ -1238,7 +1238,7 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal
}
case cmFUNC_BULK:
{
qmusizetype iArgCount = pTok->Fun.argc;
qmusizetype const iArgCount = pTok->Fun.argc;
// switch according to argument count
switch (iArgCount)
@ -1438,7 +1438,7 @@ void QmuParserBase::CreateRPN() const
// Check if a function is standing in front of the opening bracket,
// if yes evaluate it afterwards check for infix operators
assert(stArgCount.size());
int iArgCount = stArgCount.pop();
int const iArgCount = stArgCount.pop();
stOpt.pop(); // Take opening bracket from stack
@ -1495,7 +1495,7 @@ void QmuParserBase::CreateRPN() const
if (code == opt.GetCode())
{
// Deal with operator associativity
EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
EOprtAssociativity const eOprtAsct = GetOprtAssociativity(opt);
if ((eOprtAsct == oaRIGHT && (nPrec1 <= nPrec2)) || (eOprtAsct == oaLEFT && (nPrec1 < nPrec2)))
{
break;
@ -1663,7 +1663,7 @@ void QmuParserBase::ClearVar()
*/
void QmuParserBase::RemoveVar(const QString &a_strVarName)
{
varmap_type::iterator item = m_VarDef.find(a_strVarName);
varmap_type::iterator const item = m_VarDef.find(a_strVarName);
if (item != m_VarDef.end())
{
m_VarDef.erase(item);
@ -1812,7 +1812,7 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
qDebug() << "\nValue stack:\n";
while (stVal.empty() == false)
{
token_type val = stVal.pop();
token_type const val = stVal.pop();
if (val.GetType() == tpSTR)
{
qDebug() << " \"" << val.GetAsString() << "\" ";

View File

@ -139,7 +139,7 @@ void QmuParserByteCode::AddVal(qreal a_fVal)
//---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::ConstantFolding(ECmdCode a_Oprt)
{
qmusizetype sz = m_vRPN.size();
qmusizetype const sz = m_vRPN.size();
qreal &x = m_vRPN[sz-2].Val.data2,
&y = m_vRPN[sz-1].Val.data2;
switch (a_Oprt)
@ -370,7 +370,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
return;
}
qmusizetype sz = m_vRPN.size();
qmusizetype const sz = m_vRPN.size();
// Check for foldable constants like:
// cmVAL cmVAL cmADD

View File

@ -89,7 +89,7 @@ auto QmuParserTester::IsHexVal(const QString &a_szExpr, qmusizetype *a_iPos, qre
unsigned iVal ( 0 );
std::wstring a_szExprStd = a_szExpr.mid(2).toStdWString();
std::wstring const a_szExprStd = a_szExpr.mid(2).toStdWString();
// New code based on streams for UNICODE compliance:
stringstream_type::pos_type nPos(0);
@ -816,7 +816,7 @@ auto QmuParserTester::TestExpression() -> int
int iStat = 0;
qWarning() << "testing expression samples...";
qreal b = 2;
qreal const b = 2;
// Optimization
iStat += EqnTest ( "2*b*5", 20, true );
@ -1204,7 +1204,7 @@ auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail)
}
// if a_bFail==false no exception is expected
bool bRet ( ( a_bFail == false ) ? 0 : 1 );
bool const bRet((a_bFail == false) ? 0 : 1);
if ( bRet == 1 )
{
qWarning() << "\n "
@ -1375,7 +1375,7 @@ auto QmuParserTester::EqnTest(const QString &a_str, double a_fRes, bool a_fPass)
// Test copy constructor
QVector<qmu::QmuParser> vParser;
vParser.push_back ( * ( p1.get() ) );
qmu::QmuParser p2 = vParser[0]; // take parser from vector
qmu::QmuParser const p2 = vParser[0]; // take parser from vector
// destroy the originals from p2
vParser.clear(); // delete the vector
@ -1475,7 +1475,7 @@ auto QmuParserTester::EqnTestBulk(const QString &a_str, double a_fRes[4], bool a
try
{
// Define Bulk Variables
int nBulkSize = 4;
int const nBulkSize = 4;
double vVariableA[] = { 1, 2, 3, 4 }; // variable values
double vVariableB[] = { 2, 2, 2, 2 }; // variable values
double vVariableC[] = { 3, 3, 3, 3 }; // variable values

View File

@ -182,25 +182,25 @@ private:
static auto StrFun1(const QString &v1) -> qreal
{
int val = v1.toInt();
int const val = v1.toInt();
return static_cast<qreal>(val);
}
static auto StrFun2(const QString &v1, qreal v2) -> qreal
{
int val = v1.toInt();
int const val = v1.toInt();
return static_cast<qreal>(val + v2);
}
static auto StrFun3(const QString &v1, qreal v2, qreal v3) -> qreal
{
int val = v1.toInt();
int const val = v1.toInt();
return val + v2 + v3;
}
static auto StrToFloat(const QString &a_szMsg) -> qreal
{
qreal val = a_szMsg.toDouble();
qreal const val = a_szMsg.toDouble();
return val;
}

View File

@ -283,7 +283,7 @@ auto QmuParserTokenReader::ReadNextToken(const QLocale &locale, bool cNumbers, c
// !!! From this point on there is no exit without an exception possible...
//
QString strTok;
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype const iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if ( iEnd != m_iPos )
{
Error ( ecUNASSIGNABLE_TOKEN, m_iPos, strTok );
@ -381,7 +381,7 @@ auto QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok ) -> bool
// check string for operator/function
for ( int i = 0; i < pOprtDef.size(); ++i )
{
qmusizetype len = pOprtDef.at ( i ).length();
qmusizetype const len = pOprtDef.at(i).length();
if ( pOprtDef.at ( i ) == m_strFormula.mid ( m_iPos, len ) )
{
if (i >= cmLE && i <= cmASSIGN)
@ -485,7 +485,7 @@ auto QmuParserTokenReader::IsArgSep ( token_type &a_Tok ) -> bool
if ( m_strFormula.at ( m_iPos ) == m_cArgSep )
{
// copy the separator into null terminated string
QString szSep(m_cArgSep);
QString const szSep(m_cArgSep);
if ( m_iSynFlags & noARG_SEP )
{
@ -548,7 +548,7 @@ auto QmuParserTokenReader::IsEOF ( token_type &a_Tok ) -> bool
auto QmuParserTokenReader::IsInfixOpTok ( token_type &a_Tok ) -> bool
{
QString sTok;
qmusizetype iEnd = ExtractToken ( m_pParser->ValidInfixOprtChars(), sTok, m_iPos );
qmusizetype const iEnd = ExtractToken(m_pParser->ValidInfixOprtChars(), sTok, m_iPos);
if ( iEnd == m_iPos )
{
return false;
@ -587,7 +587,7 @@ auto QmuParserTokenReader::IsInfixOpTok ( token_type &a_Tok ) -> bool
auto QmuParserTokenReader::IsFunTok ( token_type &a_Tok ) -> bool
{
QString strTok;
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype const iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if ( iEnd == m_iPos )
{
return false;
@ -627,7 +627,7 @@ auto QmuParserTokenReader::IsOprt ( token_type &a_Tok ) -> bool
{
QString strTok;
qmusizetype iEnd = ExtractOperatorToken ( strTok, m_iPos );
qmusizetype const iEnd = ExtractOperatorToken(strTok, m_iPos);
if ( iEnd == m_iPos )
{
return false;
@ -714,7 +714,7 @@ auto QmuParserTokenReader::IsPostOpTok ( token_type &a_Tok ) -> bool
// Test if there could be a postfix operator
QString sTok;
qmusizetype iEnd = ExtractToken ( m_pParser->ValidOprtChars(), sTok, m_iPos );
qmusizetype const iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, m_iPos);
if ( iEnd == m_iPos )
{
return false;
@ -782,7 +782,7 @@ auto QmuParserTokenReader::IsValTok ( token_type &a_Tok, const QLocale &locale,
auto item = m_vIdentFun.begin();
for ( item = m_vIdentFun.begin(); item != m_vIdentFun.end(); ++item )
{
qmusizetype iStart = m_iPos;
qmusizetype const iStart = m_iPos;
if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal, locale, cNumbers, decimal, thousand ) == 1 )
{
// 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2
@ -854,7 +854,7 @@ auto QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok ) -> bool
}
QString strTok;
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype const iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if ( iEnd == m_iPos )
{
return false;
@ -895,7 +895,7 @@ auto QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok ) -> bool
auto QmuParserTokenReader::IsUndefVarTok ( token_type &a_Tok ) -> bool
{
QString strTok;
qmusizetype iEnd ( ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ) );
qmusizetype const iEnd(ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos));
if ( iEnd == m_iPos )
{
return false;
@ -980,7 +980,7 @@ auto QmuParserTokenReader::IsString ( token_type &a_Tok ) -> bool
Error ( ecUNTERMINATED_STRING, m_iPos, "\"" );
}
QString strTok = strBuf.mid ( 0, iEnd );
QString const strTok = strBuf.mid(0, iEnd);
if ( m_iSynFlags & noSTR )
{

View File

@ -92,7 +92,7 @@ QmuTokenParser::QmuTokenParser(const QString &formula, bool osSeparator,
*/
auto QmuTokenParser::IsSingle(const QString &formula) -> bool
{
QLocale c(QLocale::C);
QLocale const c(QLocale::C);
bool ok = false;
c.toDouble(formula, &ok);
return ok;

View File

@ -38,7 +38,7 @@ dx_iface::~dx_iface()
auto dx_iface::fileExport(bool binary) -> bool
{
bool success = dxfW->write(this, version, binary);
bool const success = dxfW->write(this, version, binary);
return success;
}
@ -518,7 +518,7 @@ void dx_iface::AddBlock(dx_ifaceBlock *block)
auto dx_iface::LocaleToISO() -> std::string
{
QMap<QString, QString> locMap = LocaleMap();
QMap<QString, QString> const locMap = LocaleMap();
return locMap.value(QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()).name(), "ISO8859-1")
.toStdString();
}

View File

@ -314,7 +314,7 @@ void DRW_Arc::applyExtrusion()
staangle = M_PI - staangle;
endangle = M_PI - endangle;
double temp = staangle;
double const temp = staangle;
staangle = endangle;
endangle = temp;
}
@ -364,7 +364,7 @@ void DRW_Ellipse::applyExtrusion()
{
calculateAxis(extPoint);
extrudePoint(extPoint, &secPoint);
double intialparam = staparam;
double const intialparam = staparam;
if (extPoint.z < 0.)
{
staparam = M_PIx2 - endparam;
@ -387,7 +387,7 @@ void DRW_Ellipse::correctAxis()
{
if (fabs(endparam - staparam - M_PIx2) < 1.0e-10)
complete = true;
double incX = secPoint.x;
double const incX = secPoint.x;
secPoint.x = -(secPoint.y * ratio);
secPoint.y = incX * ratio;
ratio = 1 / ratio;
@ -423,10 +423,10 @@ void DRW_Ellipse::toPolyline(DRW_Polyline *pol, int parts)
curAngle = endparam;
i = parts + 2;
}
double cosCurr = cos(curAngle);
double sinCurr = sin(curAngle);
double x = basePoint.x + (cosCurr * cosRot * radMajor) - (sinCurr * sinRot * radMinor);
double y = basePoint.y + (cosCurr * sinRot * radMajor) + (sinCurr * cosRot * radMinor);
double const cosCurr = cos(curAngle);
double const sinCurr = sin(curAngle);
double const x = basePoint.x + (cosCurr * cosRot * radMajor) - (sinCurr * sinRot * radMinor);
double const y = basePoint.y + (cosCurr * sinRot * radMajor) + (sinCurr * cosRot * radMinor);
pol->addVertex(DRW_Vertex(x, y, 0.0, 0.0));
curAngle = (++i) * incAngle;
} while (i < parts);

View File

@ -279,7 +279,7 @@ auto DRW_ConvTable::fromUtf8(const std::string &s) -> std::string
if (c > 0x7F)
{ // need to decode
result += s.substr(j, i - j);
std::string part1 = s.substr(i, 4);
std::string const part1 = s.substr(i, 4);
unsigned int l;
code = decodeNum(part1, &l);
j = i + l;
@ -446,7 +446,7 @@ template <size_t DoubleTableSize> auto DRW_ConvDBCSTable<DoubleTableSize>::fromU
if (c > 0x7F)
{ // need to decode
result += s.substr(j, i - j);
std::string part1 = s.substr(i, 4);
std::string const part1 = s.substr(i, 4);
unsigned int l;
code = decodeNum(part1, &l);
j = i + l;
@ -456,7 +456,7 @@ template <size_t DoubleTableSize> auto DRW_ConvDBCSTable<DoubleTableSize>::fromU
{
if (row[1] == code)
{
int data = row[0];
int const data = row[0];
char d[3];
d[0] = static_cast<char>(data >> 8);
d[1] = static_cast<char>(data & 0xFF);
@ -513,9 +513,9 @@ template <size_t DoubleTableSize> auto DRW_ConvDBCSTable<DoubleTableSize>::toUtf
else
{ // 2 bytes
++it;
int code = (c << 8) | static_cast<unsigned char>(*it);
int sta = leadTable[static_cast<size_t>(c - 0x81)];
int end = leadTable[static_cast<size_t>(c - 0x80)];
int const code = (c << 8) | static_cast<unsigned char>(*it);
int const sta = leadTable[static_cast<size_t>(c - 0x81)];
int const end = leadTable[static_cast<size_t>(c - 0x80)];
for (auto k = static_cast<size_t>(sta); k < static_cast<size_t>(end); k++)
{
if (doubleTable[k][0] == code)
@ -549,7 +549,7 @@ auto DRW_Conv932Table::fromUtf8(const std::string &s) -> std::string
if (c > 0x7F)
{ // need to decode
result += s.substr(j, i - j);
std::string part1 = s.substr(i, 4);
std::string const part1 = s.substr(i, 4);
unsigned int l;
code = decodeNum(part1, &l);
j = i + l;
@ -568,7 +568,7 @@ auto DRW_Conv932Table::fromUtf8(const std::string &s) -> std::string
{
if (row[1] == code)
{
int data = row[0];
int const data = row[0];
char d[3];
d[0] = static_cast<char>(data >> 8);
d[1] = static_cast<char>(data & 0xFF);
@ -624,7 +624,7 @@ auto DRW_Conv932Table::toUtf8(const std::string &s) -> std::string
else
{ // 2 bytes
++it;
int code = (c << 8) | static_cast<unsigned char>(*it);
int const code = (c << 8) | static_cast<unsigned char>(*it);
int sta = 0;
int end = 0;
if (c > 0x80 && c < 0xA0)

View File

@ -93,7 +93,7 @@
auto dxfWriter::writeUtf8String(int code, const std::string &text) -> bool
{
std::string t = encoder.fromUtf8(text);
std::string const t = encoder.fromUtf8(text);
return writeString(code, t);
}
@ -101,7 +101,7 @@ auto dxfWriter::writeUtf8Caps(int code, const std::string &text) -> bool
{
std::string strname = text;
std::transform(strname.begin(), strname.end(), strname.begin(),::toupper);
std::string t = encoder.fromUtf8(strname);
std::string const t = encoder.fromUtf8(strname);
return writeString(code, t);
}

View File

@ -100,7 +100,7 @@ auto dxfRW::read(DRW_Interface *interface_, bool ext) -> bool
reader = std::make_unique<dxfReaderAscii>(&filestr);
}
bool isOk = processDxf();
bool const isOk = processDxf();
filestr.close();
reader.reset();
reader = nullptr;
@ -671,7 +671,7 @@ auto dxfRW::writeDimstyle(DRW_Dimstyle *ent) -> bool
std::transform(txstyname.begin(), txstyname.end(), txstyname.begin(), ::toupper);
if (textStyleMap.count(txstyname) > 0)
{
int txstyHandle = (*(textStyleMap.find(txstyname))).second;
int const txstyHandle = (*(textStyleMap.find(txstyname))).second;
writer->writeUtf8String(340, toHexStr(txstyHandle));
}
}
@ -679,7 +679,7 @@ auto dxfRW::writeDimstyle(DRW_Dimstyle *ent) -> bool
{
if (blockMap.count(ent->dimldrblk) > 0)
{
int blkHandle = (*(blockMap.find(ent->dimldrblk))).second;
int const blkHandle = (*(blockMap.find(ent->dimldrblk))).second;
writer->writeUtf8String(341, toHexStr(blkHandle));
writer->writeInt16(371, ent->dimlwd);
writer->writeInt16(372, ent->dimlwe);
@ -1096,7 +1096,7 @@ auto dxfRW::writePolyline(DRW_Polyline *ent) -> bool
{
writer->writeInt16(75, ent->curvetype);
}
DRW_Coord crd = ent->extPoint;
DRW_Coord const crd = ent->extPoint;
if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not DRW_FuzzyComparePossibleNulls(crd.z, 1))
{
writer->writeDouble(210, crd.x);
@ -1104,7 +1104,7 @@ auto dxfRW::writePolyline(DRW_Polyline *ent) -> bool
writer->writeDouble(230, crd.z);
}
size_t vertexnum = ent->vertlist.size();
size_t const vertexnum = ent->vertlist.size();
for (size_t i = 0; i < vertexnum; i++)
{
DRW_Vertex *v = ent->vertlist.at(i);
@ -1400,7 +1400,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
{
DRW_DimAligned *dd = static_cast<DRW_DimAligned *>(ent);
writer->writeString(100, "AcDbAlignedDimension");
DRW_Coord crd = dd->getClonepoint();
DRW_Coord const crd = dd->getClonepoint();
if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not qFuzzyIsNull(crd.z))
{
writer->writeDouble(12, crd.x);
@ -1589,7 +1589,7 @@ auto dxfRW::writeMText(DRW_MText *ent) -> bool
writer->writeDouble(41, ent->widthscale);
writer->writeInt16(71, ent->textgen);
writer->writeInt16(72, ent->alignH);
std::string text = writer->fromUtf8String(ent->text);
std::string const text = writer->fromUtf8String(ent->text);
int i;
for (i = 0; (text.size() - static_cast<size_t>(i)) > 250;)
@ -1656,7 +1656,7 @@ auto dxfRW::writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef
id->handle = static_cast<duint32>(++entCount);
}
id->fileName = name;
std::string idReactor = toHexStr(++entCount);
std::string const idReactor = toHexStr(++entCount);
writer->writeString(0, "IMAGE");
writeEntity(ent);
@ -2282,7 +2282,7 @@ auto dxfRW::writeExtData(const std::vector<DRW_Variant *> &ed) -> bool
case 1004:
case 1005:
{
int cc = (*it)->code;
int const cc = (*it)->code;
if ((*it)->type == DRW_Variant::STRING)
writer->writeUtf8String(cc, *(*it)->content.s);
// writer->writeUtf8String((*it)->code, (*it)->content.s);
@ -2350,7 +2350,7 @@ auto dxfRW::processDxf() -> bool
reader->setIgnoreComments(true);
if (!inSection)
{
std::string sectionstr{reader->getString()};
std::string const sectionstr{reader->getString()};
if ("SECTION" == sectionstr)
{
@ -2378,7 +2378,7 @@ auto dxfRW::processDxf() -> bool
if (inSection)
{
bool processed{false};
std::string sectionname{reader->getString()};
std::string const sectionname{reader->getString()};
DRW_DBG(sectionname);
DRW_DBG(" process section\n");
@ -3571,7 +3571,7 @@ auto dxfRW::processDimension() -> bool
nextentity = reader->getString();
DRW_DBG(nextentity);
DRW_DBG("\n");
int type = dim.type & 0x0F;
int const type = dim.type & 0x0F;
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
@ -3581,43 +3581,43 @@ auto dxfRW::processDimension() -> bool
{
case 0:
{
DRW_DimLinear d(dim);
DRW_DimLinear const d(dim);
iface->addDimLinear(&d);
break;
}
case 1:
{
DRW_DimAligned d(dim);
DRW_DimAligned const d(dim);
iface->addDimAlign(&d);
break;
}
case 2:
{
DRW_DimAngular d(dim);
DRW_DimAngular const d(dim);
iface->addDimAngular(&d);
break;
}
case 3:
{
DRW_DimDiametric d(dim);
DRW_DimDiametric const d(dim);
iface->addDimDiametric(&d);
break;
}
case 4:
{
DRW_DimRadial d(dim);
DRW_DimRadial const d(dim);
iface->addDimRadial(&d);
break;
}
case 5:
{
DRW_DimAngular3p d(dim);
DRW_DimAngular3p const d(dim);
iface->addDimAngular3P(&d);
break;
}
case 6:
{
DRW_DimOrdinate d(dim);
DRW_DimOrdinate const d(dim);
iface->addDimOrdinate(&d);
break;
}

View File

@ -602,7 +602,7 @@ auto VDxfEngine::GetPenStyle() -> std::string
//---------------------------------------------------------------------------------------------------------------------
auto VDxfEngine::GetPenColor() -> int
{
QColor color = state->pen().color();
QColor const color = state->pen().color();
if (color == Qt::black)
{
@ -851,8 +851,8 @@ void VDxfEngine::ExportAAMAOutline(const QSharedPointer<dx_ifaceBlock> &detailBl
{
const QVector<VLayoutPassmark> passmarks = detail.GetMappedPassmarks();
bool seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn();
bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool const seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn();
bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
VBoundary boundary(points, seamAllowance, builtInSeamAllowance);
boundary.SetPieceName(detail.GetName());
@ -910,7 +910,7 @@ void VDxfEngine::ExportAAMADrawSewLine(const QSharedPointer<dx_ifaceBlock> &deta
if (detail.IsSeamAllowance() && not detail.IsHideMainPath() && not detail.IsSeamAllowanceBuiltIn())
{
const UTF8STRING &layer = not detail.IsSewLineOnDrawing() ? *layer14 : *layer8;
QVector<VLayoutPoint> points = detail.GetMappedFullContourPoints();
QVector<VLayoutPoint> const points = detail.GetMappedFullContourPoints();
auto DrawPolygon = [this, detailBlock, layer](const QVector<VLayoutPoint> &points, bool forceClosed)
{
@ -927,8 +927,8 @@ void VDxfEngine::ExportAAMADrawSewLine(const QSharedPointer<dx_ifaceBlock> &deta
{
const QVector<VLayoutPassmark> passmarks = detail.GetMappedPassmarks();
bool seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool const seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
VBoundary boundary(points, seamAllowance, builtInSeamAllowance);
boundary.SetPieceName(detail.GetName());
@ -1039,7 +1039,7 @@ void VDxfEngine::ExportAAMAIntcut(const QSharedPointer<dx_ifaceBlock> &detailBlo
ExportCurvePoints(detailBlock, points);
};
QVector<VLayoutPiecePath> drawIntCut = detail.MappedInternalPathsForCut(true);
QVector<VLayoutPiecePath> const drawIntCut = detail.MappedInternalPathsForCut(true);
for (auto &intCut : drawIntCut)
{
QVector<VLayoutPoint> points = intCut.Points();
@ -1084,7 +1084,7 @@ void VDxfEngine::ExportAAMANotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
{
const QTransform matrix = VGObject::FlippingMatrix(mirrorLine);
QLineF baseLine = matrix.map(passmark.baseLine);
QLineF const baseLine = matrix.map(passmark.baseLine);
ExportNotch(baseLine.p1(), baseLine.length(), baseLine.angle());
}
}
@ -1245,7 +1245,7 @@ void VDxfEngine::ExportStyleSystemText(const QSharedPointer<dx_iface> &input, co
for (int j = 0; j < strings.size(); ++j)
{
const qreal height = ToPixel(AAMATextHeight * m_yscale, m_varInsunits);
QPointF pos(0, GetSize().height() - height * (static_cast<int>(strings.size()) - j - 1));
QPointF const pos(0, GetSize().height() - height * (static_cast<int>(strings.size()) - j - 1));
input->AddEntity(AAMAText(pos, strings.at(j), *layer1));
}
return;
@ -1392,8 +1392,8 @@ void VDxfEngine::ExportASTMPieceBoundary(const QSharedPointer<dx_ifaceBlock> &de
{
const QVector<VLayoutPassmark> passmarks = detail.GetMappedPassmarks();
bool seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn();
bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool const seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn();
bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
VBoundary boundary(pieceBoundary, seamAllowance, builtInSeamAllowance);
boundary.SetPieceName(detail.GetName());
@ -1435,7 +1435,7 @@ void VDxfEngine::ExportASTMSewLine(const QSharedPointer<dx_ifaceBlock> &detailBl
{
if (detail.IsSeamAllowance() && not detail.IsHideMainPath() && not detail.IsSeamAllowanceBuiltIn())
{
QVector<VLayoutPoint> sewLine = detail.GetMappedFullContourPoints();
QVector<VLayoutPoint> const sewLine = detail.GetMappedFullContourPoints();
auto DrawPolygon = [this, detailBlock](const QVector<VLayoutPoint> &points, bool forceClosed)
{
@ -1459,8 +1459,8 @@ void VDxfEngine::ExportASTMSewLine(const QSharedPointer<dx_ifaceBlock> &detailBl
{
const QVector<VLayoutPassmark> passmarks = detail.GetMappedPassmarks();
bool seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool const seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn();
VBoundary boundary(sewLine, seamAllowance, builtInSeamAllowance);
boundary.SetPieceName(detail.GetName());
@ -1499,7 +1499,8 @@ void VDxfEngine::ExportASTMDrawInternalPaths(const QSharedPointer<dx_ifaceBlock>
if (notMirrored && !points.isEmpty())
{
QPointF pos(points.constFirst().x(), points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits));
QPointF const pos(points.constFirst().x(),
points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits));
detailBlock->ent.push_back(AAMAText(pos, QStringLiteral("NM"), *layer8));
}
@ -1544,7 +1545,8 @@ void VDxfEngine::ExportASTMDrawPlaceLabels(const QSharedPointer<dx_ifaceBlock> &
if (notMirrored && !points.isEmpty())
{
QPointF pos(points.constFirst().x(), points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits));
QPointF const pos(points.constFirst().x(),
points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits));
detailBlock->ent.push_back(AAMAText(pos, QStringLiteral("NM"), *layer8));
}
@ -1597,7 +1599,8 @@ void VDxfEngine::ExportASTMInternalCutout(const QSharedPointer<dx_ifaceBlock> &d
if (notMirrored && !points.isEmpty())
{
QPointF pos(points.constFirst().x(), points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits));
QPointF const pos(points.constFirst().x(),
points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits));
detailBlock->ent.push_back(AAMAText(pos, QStringLiteral("NM"), *layer11));
}
@ -1611,7 +1614,7 @@ void VDxfEngine::ExportASTMInternalCutout(const QSharedPointer<dx_ifaceBlock> &d
}
};
QVector<VLayoutPiecePath> drawIntCut = detail.MappedInternalPathsForCut(true);
QVector<VLayoutPiecePath> const drawIntCut = detail.MappedInternalPathsForCut(true);
for (auto &intCut : drawIntCut)
{
QVector<VLayoutPoint> points = intCut.Points();
@ -1801,8 +1804,8 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot
break;
case PassmarkLineType::BoxMark:
{ // Castle Notch
QPointF start = passmark.lines.constFirst().p1();
QPointF end = passmark.lines.constLast().p2();
QPointF const start = passmark.lines.constFirst().p1();
QPointF const end = passmark.lines.constLast().p2();
notch->layer = *layer81;
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
@ -1810,8 +1813,8 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot
}
case PassmarkLineType::UMark:
{ // U-Notch
QPointF start = passmark.lines.constFirst().p1();
QPointF end = passmark.lines.constLast().p2();
QPointF const start = passmark.lines.constFirst().p1();
QPointF const end = passmark.lines.constLast().p2();
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
@ -1848,7 +1851,7 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot
auto VDxfEngine::ExportASTMNotchDataDependecy(const VLayoutPassmark &passmark, const UTF8STRING &notchLayer,
const VLayoutPiece &detail) -> DRW_ATTDEF *
{
QVector<VLayoutPoint> boundary = not detail.IsSeamAllowanceBuiltIn() && !passmark.isBuiltIn
QVector<VLayoutPoint> const boundary = not detail.IsSeamAllowanceBuiltIn() && !passmark.isBuiltIn
? detail.GetMappedSeamAllowancePoints()
: detail.GetMappedContourPoints();

View File

@ -51,7 +51,7 @@ QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
void VKnownMeasurementsDatabase::PopulateMeasurementsDatabase()
{
QMutexLocker locker(knownMeasurementsDatabaseMutex());
QMutexLocker const locker(knownMeasurementsDatabaseMutex());
m_measurementsCache.clear();
@ -69,7 +69,7 @@ void VKnownMeasurementsDatabase::PopulateMeasurementsDatabase()
//---------------------------------------------------------------------------------------------------------------------
auto VKnownMeasurementsDatabase::IsPopulated() const -> bool
{
QMutexLocker locker(knownMeasurementsDatabaseMutex());
QMutexLocker const locker(knownMeasurementsDatabaseMutex());
return m_populated;
}
@ -92,7 +92,7 @@ auto VKnownMeasurementsDatabase::KnownMeasurements(const QUuid &id) const -> VKn
return {*m_measurementsCache.object(id)};
}
QString measurementsFilePath = m_indexMeasurementsPath.value(id);
QString const measurementsFilePath = m_indexMeasurementsPath.value(id);
if (measurementsFilePath.isEmpty())
{
return {};
@ -136,7 +136,7 @@ void VKnownMeasurementsDatabase::ParseDirectory(const QString &path)
QDirIterator it(path, {"*.vkm"}, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext())
{
QString measurementsFilePath = it.next();
QString const measurementsFilePath = it.next();
try
{

View File

@ -90,7 +90,7 @@ VKnownMeasurementsDocument::VKnownMeasurementsDocument(QObject *parent)
auto VKnownMeasurementsDocument::SaveDocument(const QString &fileName, QString &error) -> bool
{
// Update comment with Valentina version
QDomNode commentNode = documentElement().firstChild();
QDomNode const commentNode = documentElement().firstChild();
if (commentNode.isComment())
{
QDomComment comment = commentNode.toComment();
@ -255,7 +255,7 @@ void VKnownMeasurementsDocument::MoveBottom(const QString &name)
//---------------------------------------------------------------------------------------------------------------------
auto VKnownMeasurementsDocument::GetUId() const -> QUuid
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
const QDomElement rootElement = root.toElement();
@ -270,7 +270,7 @@ auto VKnownMeasurementsDocument::GetUId() const -> QUuid
//---------------------------------------------------------------------------------------------------------------------
void VKnownMeasurementsDocument::SetUId(const QUuid &id)
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
QDomElement rootElement = root.toElement();
@ -312,7 +312,7 @@ void VKnownMeasurementsDocument::SetDescription(const QString &desc)
//---------------------------------------------------------------------------------------------------------------------
auto VKnownMeasurementsDocument::IsReadOnly() const -> bool
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
const QDomElement rootElement = root.toElement();
@ -327,7 +327,7 @@ auto VKnownMeasurementsDocument::IsReadOnly() const -> bool
//---------------------------------------------------------------------------------------------------------------------
void VKnownMeasurementsDocument::SetReadOnly(bool ro)
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
QDomElement rootElement = root.toElement();
@ -537,7 +537,7 @@ auto VKnownMeasurementsDocument::FindM(const QString &name) const -> QDomElement
return {};
}
QDomNodeList list = elementsByTagName(*tagMeasurement);
QDomNodeList const list = elementsByTagName(*tagMeasurement);
for (int i = 0; i < list.size(); ++i)
{
@ -580,9 +580,9 @@ auto VKnownMeasurementsDocument::FindImage(const QUuid &id) const -> QDomElement
return {};
}
QDomNodeList list = elementsByTagName(*tagImage);
QDomNodeList const list = elementsByTagName(*tagImage);
QString idString = id.toString();
QString const idString = id.toString();
for (int i = 0; i < list.size(); ++i)
{
@ -627,7 +627,7 @@ void VKnownMeasurementsDocument::ReadImages(VKnownMeasurements &known) const
//---------------------------------------------------------------------------------------------------------------------
void VKnownMeasurementsDocument::ReadMeasurements(VKnownMeasurements &known) const
{
QDomNodeList list = elementsByTagName(*tagMeasurement);
QDomNodeList const list = elementsByTagName(*tagMeasurement);
for (int i = 0; i < list.size(); ++i)
{
@ -654,7 +654,7 @@ void VKnownMeasurementsDocument::ReadMeasurements(VKnownMeasurements &known) con
//---------------------------------------------------------------------------------------------------------------------
void VKnownMeasurementsDocument::UpdateDiagramId(const QUuid &oldId, const QUuid &newId)
{
QDomNodeList list = elementsByTagName(*tagMeasurement);
QDomNodeList const list = elementsByTagName(*tagMeasurement);
for (int i = 0; i < list.size(); ++i)
{

View File

@ -151,7 +151,7 @@ auto VAbstartMeasurementDimension::ValidBases() const -> QVector<qreal>
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::ValidBasesList() const -> QStringList
{
QVector<qreal> bases = ValidBases();
QVector<qreal> const bases = ValidBases();
QStringList list;
list.reserve(bases.size());
for(auto &base : bases)
@ -212,7 +212,7 @@ auto VAbstartMeasurementDimension::ValidBases(qreal min, qreal max, qreal step,
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::IsRangeValid() const -> bool
{
bool valid = m_minValue > 0 && m_maxValue > 0 &&
bool const valid = m_minValue > 0 && m_maxValue > 0 &&
(m_minValue > RangeMin() || VFuzzyComparePossibleNulls(m_minValue, RangeMin())) &&
(m_maxValue < RangeMax() || VFuzzyComparePossibleNulls(m_maxValue, RangeMax())) &&
(m_minValue < m_maxValue || VFuzzyComparePossibleNulls(m_minValue, m_maxValue));
@ -228,7 +228,7 @@ auto VAbstartMeasurementDimension::IsRangeValid() const -> bool
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::IsStepValid() const -> bool
{
bool valid = VFuzzyIndexOf(ValidSteps(), m_step) != -1;
bool const valid = VFuzzyIndexOf(ValidSteps(), m_step) != -1;
if (not valid)
{
m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Invalid step");
@ -240,7 +240,7 @@ auto VAbstartMeasurementDimension::IsStepValid() const -> bool
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::IsBaseValid() const -> bool
{
bool valid = VFuzzyIndexOf(ValidBases(), m_baseValue) != -1;
bool const valid = VFuzzyIndexOf(ValidBases(), m_baseValue) != -1;
if (not valid)
{
m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Base value invalid");
@ -252,7 +252,7 @@ auto VAbstartMeasurementDimension::IsBaseValid() const -> bool
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::IsUnitsValid() const -> bool
{
bool valid = (m_units == Unit::Cm || m_units == Unit::Mm || m_units == Unit::Inch);
bool const valid = (m_units == Unit::Cm || m_units == Unit::Mm || m_units == Unit::Inch);
if (not valid)
{
@ -381,11 +381,11 @@ void VDimensionRestriction::SetExcludeString(const QString &exclude)
{
m_exclude.clear();
QStringList values = exclude.split(';');
QStringList const values = exclude.split(';');
for(auto &value : values)
{
bool ok = false;
qreal val = value.toDouble(&ok);
qreal const val = value.toDouble(&ok);
if (ok)
{
@ -397,7 +397,7 @@ void VDimensionRestriction::SetExcludeString(const QString &exclude)
//---------------------------------------------------------------------------------------------------------------------
auto VDimensionRestriction::GetExcludeString() const -> QString
{
QList<qreal> list = m_exclude.values();
QList<qreal> const list = m_exclude.values();
QStringList excludeList;
for(auto &value : list)

View File

@ -180,7 +180,7 @@ void VMeasurements::setXMLContent(const QString &fileName)
auto VMeasurements::SaveDocument(const QString &fileName, QString &error) -> bool
{
// Update comment with Valentina version
QDomNode commentNode = documentElement().firstChild();
QDomNode const commentNode = documentElement().firstChild();
if (commentNode.isComment())
{
QDomComment comment = commentNode.toComment();
@ -632,7 +632,7 @@ void VMeasurements::SetReadOnly(bool ro)
//---------------------------------------------------------------------------------------------------------------------
auto VMeasurements::IsFullCircumference() const -> bool
{
QDomElement dimenstionsTag = documentElement().firstChildElement(TagDimensions);
QDomElement const dimenstionsTag = documentElement().firstChildElement(TagDimensions);
if (not dimenstionsTag.isNull())
{
return GetParametrBool(dimenstionsTag, AttrFullCircumference, falseStr);
@ -850,7 +850,7 @@ void VMeasurements::SetMImage(const QString &name, const VPatternImage &image)
auto VMeasurements::MeasurementForDimension(IMD type) const -> QString
{
const QString d = VMeasurements::IMDToStr(type);
QDomNodeList list = elementsByTagName(TagMeasurement);
QDomNodeList const list = elementsByTagName(TagMeasurement);
for (int i = 0; i < list.size(); ++i)
{
@ -882,7 +882,7 @@ auto VMeasurements::GetRestrictions() const -> QMap<QString, VDimensionRestricti
{
const QDomElement res = list.at(i).toElement();
QString coordinates = GetParametrString(res, AttrCoordinates);
QString const coordinates = GetParametrString(res, AttrCoordinates);
const qreal min = GetParametrDouble(res, AttrMin, QChar('0'));
const qreal max = GetParametrDouble(res, AttrMax, QChar('0'));
const QString exclude = GetParametrEmptyString(res, AttrExclude);
@ -896,7 +896,7 @@ auto VMeasurements::GetRestrictions() const -> QMap<QString, VDimensionRestricti
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetRestrictions(const QMap<QString, VDimensionRestriction> &restrictions)
{
QDomElement root = documentElement();
QDomElement const root = documentElement();
QDomElement restrictionsTag = root.firstChildElement(TagRestrictions);
if (restrictionsTag.isNull())
@ -1279,7 +1279,7 @@ auto VMeasurements::FindM(const QString &name) const -> QDomElement
return {};
}
QDomNodeList list = elementsByTagName(TagMeasurement);
QDomNodeList const list = elementsByTagName(TagMeasurement);
for (int i = 0; i < list.size(); ++i)
{
@ -1302,7 +1302,7 @@ auto VMeasurements::FindM(const QString &name) const -> QDomElement
//---------------------------------------------------------------------------------------------------------------------
auto VMeasurements::ReadType() const -> MeasurementsType
{
QDomElement root = documentElement();
QDomElement const root = documentElement();
if (root.tagName() == TagVST)
{
return MeasurementsType::Multisize;
@ -1401,7 +1401,7 @@ auto VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool *
try
{
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
const qreal result = cal->EvalFormula(data->DataVariables(), formula);
(qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true;
@ -1423,7 +1423,7 @@ auto VMeasurements::ReadCorrections(const QDomElement &mElement) const -> QMap<Q
return {};
}
QDomElement correctionsTag = mElement.firstChildElement(TagCorrections);
QDomElement const correctionsTag = mElement.firstChildElement(TagCorrections);
if (correctionsTag.isNull())
{
return {};
@ -1488,7 +1488,7 @@ void VMeasurements::WriteCorrections(QDomElement &mElement, const QMap<QString,
//---------------------------------------------------------------------------------------------------------------------
auto VMeasurements::ReadImage(const QDomElement &mElement) -> VPatternImage
{
QDomElement imageTag = mElement.firstChildElement(TagImage);
QDomElement const imageTag = mElement.firstChildElement(TagImage);
if (imageTag.isNull())
{
return {};
@ -1583,7 +1583,7 @@ auto VMeasurements::ReadDimensionLabels(const QDomElement &dElement) const -> Di
return {};
}
QDomElement labelsTag = dElement.firstChildElement(TagLabels);
QDomElement const labelsTag = dElement.firstChildElement(TagLabels);
if (labelsTag.isNull())
{
return {};
@ -1615,7 +1615,7 @@ auto VMeasurements::ReadDimensionLabels(const QDomElement &dElement) const -> Di
void VMeasurements::ClearDimension(IMD type)
{
const QString d = VMeasurements::IMDToStr(type);
QDomNodeList list = elementsByTagName(TagMeasurement);
QDomNodeList const list = elementsByTagName(TagMeasurement);
for (int i = 0; i < list.size(); ++i)
{

View File

@ -175,7 +175,7 @@ auto VPatternRecipe::Measurements() -> QDomElement
{
QDomElement measurements = createElement(QStringLiteral("measurements"));
VContainer data = m_pattern->GetCompleteData();
VContainer const data = m_pattern->GetCompleteData();
QList<QSharedPointer<VMeasurement>> patternMeasurements = data.DataMeasurementsWithSeparators().values();
// Resore order
@ -208,7 +208,7 @@ auto VPatternRecipe::Measurement(const QSharedPointer<VMeasurement> &m) -> QDomE
{
SetAttribute(measurement, QStringLiteral("fullName"), m->GetGuiText());
QString formula = m->GetFormula();
QString const formula = m->GetFormula();
if (not formula.isEmpty())
{
SetAttribute(measurement, QStringLiteral("formula"), m->GetFormula());
@ -232,7 +232,7 @@ auto VPatternRecipe::Increments() -> QDomElement
{
QDomElement increments = createElement(QStringLiteral("increments"));
VContainer data = m_pattern->GetCompleteData();
VContainer const data = m_pattern->GetCompleteData();
QList<QSharedPointer<VIncrement>> patternIncrements = data.DataIncrementsWithSeparators().values();
// Resore order
@ -256,7 +256,7 @@ auto VPatternRecipe::PreviewCalculations() -> QDomElement
{
QDomElement previewCalculations = createElement(QStringLiteral("previewCalculations"));
VContainer data = m_pattern->GetCompleteData();
VContainer const data = m_pattern->GetCompleteData();
QList<QSharedPointer<VIncrement>> patternIncrements = data.DataIncrementsWithSeparators().values();
// Resore order
@ -304,7 +304,7 @@ auto VPatternRecipe::Content() -> QDomElement
const QDomNodeList draws = m_pattern->documentElement().elementsByTagName(VAbstractPattern::TagDraw);
for (int i = 0; i < draws.size(); ++i)
{
QDomElement draw = draws.at(i).toElement();
QDomElement const draw = draws.at(i).toElement();
if (draw.isNull())
{
throw VExceptionInvalidHistory(tr("Invalid tag %1").arg(VAbstractPattern::TagDraw));
@ -326,14 +326,14 @@ auto VPatternRecipe::Draft(const QDomElement &draft) -> QDomElement
const QString draftName = draft.attribute(QStringLiteral("name"));
SetAttribute(recipeDraft, QStringLiteral("name"), draftName);
VContainer data = m_pattern->GetCompletePPData(draftName);
VContainer const data = m_pattern->GetCompletePPData(draftName);
QVector<VToolRecord> *history = m_pattern->getHistory();
for (auto &record : *history)
{
if (record.getNameDraw() == draftName)
{
QDomElement step = Step(record, data);
QDomElement const step = Step(record, data);
if (not step.isNull())
{
recipeDraft.appendChild(step);
@ -482,7 +482,7 @@ auto VPatternRecipe::FinalMeasurements() -> QDomElement
QDomElement recipeFinalMeasurements = createElement(QStringLiteral("finalMeasurements"));
const QVector<VFinalMeasurement> measurements = m_pattern->GetFinalMeasurements();
VContainer data = m_pattern->GetCompleteData();
VContainer const data = m_pattern->GetCompleteData();
for (const auto &m : measurements)
{
@ -501,7 +501,7 @@ auto VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm, const VContai
SetAttribute(recipeFinalMeasurement, QStringLiteral("name"), fm.name);
SetAttribute(recipeFinalMeasurement, QStringLiteral("formula"), fm.formula); // TODO: localize
QScopedPointer<Calculator> cal(new Calculator());
QScopedPointer<Calculator> const cal(new Calculator());
try
{
const qreal result = cal->EvalFormula(data.DataVariables(), fm.formula);
@ -656,7 +656,7 @@ auto VPatternRecipe::LineIntersect(const VToolRecord &record) -> QDomElement
auto VPatternRecipe::Spline(const VToolRecord &record) -> QDomElement
{
auto *tool = GetPatternTool<VToolSpline>(record.getId());
VSpline spl = tool->getSpline();
VSpline const spl = tool->getSpline();
QDomElement step = createElement(TagStep);
@ -687,7 +687,7 @@ auto VPatternRecipe::Spline(const VToolRecord &record) -> QDomElement
auto VPatternRecipe::CubicBezier(const VToolRecord &record) -> QDomElement
{
auto *tool = GetPatternTool<VToolCubicBezier>(record.getId());
VCubicBezier spl = tool->getSpline();
VCubicBezier const spl = tool->getSpline();
QDomElement step = createElement(TagStep);
@ -743,7 +743,7 @@ auto VPatternRecipe::ArcWithLength(const VToolRecord &record) -> QDomElement
auto VPatternRecipe::SplinePath(const VToolRecord &record) -> QDomElement
{
auto *tool = GetPatternTool<VToolSplinePath>(record.getId());
VSplinePath spl = tool->getSplinePath();
VSplinePath const spl = tool->getSplinePath();
QDomElement step = createElement(TagStep);
@ -751,7 +751,7 @@ auto VPatternRecipe::SplinePath(const VToolRecord &record) -> QDomElement
SetAttribute(step, AttrLabel, tool->name());
QDomElement nodes = createElement(QStringLiteral("nodes"));
QVector<VSplinePoint> path = spl.GetSplinePath();
QVector<VSplinePoint> const path = spl.GetSplinePath();
if (path.isEmpty())
{
@ -790,14 +790,14 @@ auto VPatternRecipe::SplinePath(const VToolRecord &record) -> QDomElement
auto VPatternRecipe::CubicBezierPath(const VToolRecord &record) -> QDomElement
{
auto *tool = GetPatternTool<VToolCubicBezierPath>(record.getId());
VCubicBezierPath spl = tool->getSplinePath();
VCubicBezierPath const spl = tool->getSplinePath();
QDomElement step = createElement(TagStep);
ToolAttributes(step, tool);
QDomElement nodes = createElement(QStringLiteral("nodes"));
QVector<VSplinePoint> path = spl.GetSplinePath();
QVector<VSplinePoint> const path = spl.GetSplinePath();
if (path.isEmpty())
{
@ -1210,7 +1210,7 @@ auto VPatternRecipe::GroupOperationSource(VAbstractOperation *tool, quint32 id,
SCASSERT(tool)
QDomElement nodes = createElement(QStringLiteral("nodes"));
QVector<SourceItem> items = tool->SourceItems();
QVector<SourceItem> const items = tool->SourceItems();
if (items.isEmpty())
{

View File

@ -63,10 +63,10 @@ Q_REQUIRED_RESULT auto ParseCorrectiosn(const QJsonObject &correctionsObject) ->
}
QHash<int, bool> segments;
QJsonObject segmentsObject = it.value().toObject();
QJsonObject const segmentsObject = it.value().toObject();
for (auto segmentsIt = segmentsObject.constBegin(); segmentsIt != segmentsObject.constEnd(); ++segmentsIt)
{
bool correct = segmentsIt.value().toBool();
bool const correct = segmentsIt.value().toBool();
if (!correct)
{
segments.insert(segmentsIt.key().toInt(), correct);
@ -111,7 +111,7 @@ VSingleLineOutlineChar::VSingleLineOutlineChar(const QFont &font)
//---------------------------------------------------------------------------------------------------------------------
void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const
{
QRawFont rawFont = QRawFont::fromFont(m_font);
QRawFont const rawFont = QRawFont::fromFont(m_font);
QJsonObject correctionsObject;
for (uint unicode = 0; unicode <= 0x10FFFF; ++unicode)
@ -119,7 +119,7 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const
// Check if the glyph is available for the font
if (rawFont.supportsCharacter(unicode))
{
QChar character(unicode);
QChar const character(unicode);
QPainterPath path;
path.addText(0, 0, m_font, character);
@ -140,7 +140,7 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const
}
}
QString filename = QStringLiteral("%1/%2.json").arg(dirPath, m_font.family());
QString const filename = QStringLiteral("%1/%2.json").arg(dirPath, m_font.family());
QFile jsonFile(filename);
if (!jsonFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
@ -148,7 +148,7 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const
return;
}
QJsonDocument jsonDocument(correctionsObject);
QJsonDocument const jsonDocument(correctionsObject);
// Write the JSON string to the file
QTextStream out(&jsonFile);
@ -158,16 +158,16 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const
//---------------------------------------------------------------------------------------------------------------------
void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const
{
QString fileName = QStringLiteral("%1.json").arg(m_font.family());
QString const fileName = QStringLiteral("%1.json").arg(m_font.family());
QDir directory(dirPath);
directory.setNameFilters(QStringList(fileName));
QStringList matchingFiles = directory.entryList();
QStringList const matchingFiles = directory.entryList();
if (matchingFiles.isEmpty())
{
return;
}
QString filePath = directory.absoluteFilePath(matchingFiles.constFirst());
QString const filePath = directory.absoluteFilePath(matchingFiles.constFirst());
QFile jsonFile(filePath);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
@ -177,10 +177,10 @@ void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const
}
// Read the JSON data from the file
QByteArray jsonData = jsonFile.readAll();
QByteArray const jsonData = jsonFile.readAll();
// Create a JSON document from the JSON data
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData);
QJsonDocument const jsonDocument = QJsonDocument::fromJson(jsonData);
if (jsonDocument.isNull())
{
@ -188,14 +188,14 @@ void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const
return;
}
QMutexLocker locker(singleLineOutlineCharMutex());
QMutexLocker const locker(singleLineOutlineCharMutex());
cachedCorrections()->insert(m_font.family(), ParseCorrectiosn(jsonDocument.object()));
}
//---------------------------------------------------------------------------------------------------------------------
void VSingleLineOutlineChar::ClearCorrectionsCache()
{
QMutexLocker locker(singleLineOutlineCharMutex());
QMutexLocker const locker(singleLineOutlineCharMutex());
cachedCorrections()->remove(m_font.family());
}

View File

@ -79,7 +79,7 @@ void VWatermark::CreateEmptyWatermark()
auto VWatermark::SaveDocument(const QString &fileName, QString &error) -> bool
{
// Update comment with Valentina version
QDomNode commentNode = documentElement().firstChild();
QDomNode const commentNode = documentElement().firstChild();
if (commentNode.isComment())
{
QDomComment comment = commentNode.toComment();
@ -94,13 +94,13 @@ auto VWatermark::GetWatermark() const -> VWatermarkData
{
VWatermarkData data;
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
const QDomElement rootElement = root.toElement();
data.opacity = GetParametrInt(rootElement, AttrOpacity, QChar('2'));
QDomElement text = rootElement.firstChildElement(TagText);
QDomElement const text = rootElement.firstChildElement(TagText);
if (not text.isNull())
{
data.showText = GetParametrBool(text, AttrShow, trueStr);
@ -115,7 +115,7 @@ auto VWatermark::GetWatermark() const -> VWatermarkData
data.textColor = color;
}
QDomElement image = rootElement.firstChildElement(TagImage);
QDomElement const image = rootElement.firstChildElement(TagImage);
if (not image.isNull())
{
data.showImage = GetParametrBool(image, AttrShow, trueStr);
@ -131,7 +131,7 @@ auto VWatermark::GetWatermark() const -> VWatermarkData
//---------------------------------------------------------------------------------------------------------------------
void VWatermark::SetWatermark(const VWatermarkData &data)
{
QDomNode root = documentElement();
QDomNode const root = documentElement();
if (not root.isNull() && root.isElement())
{
QDomElement rootElement = root.toElement();

View File

@ -109,7 +109,7 @@ auto GetSystemMemorySize() -> qint64
//---------------------------------------------------------------------------------------------------------------------
auto GetSystemMemorySizeGB() -> double
{
qint64 totalMemoryBytes = GetSystemMemorySize();
qint64 const totalMemoryBytes = GetSystemMemorySize();
if (totalMemoryBytes != -1)
{
return static_cast<double>(totalMemoryBytes) / (1024 * 1024 * 1024); // Convert bytes to gigabytes
@ -121,7 +121,7 @@ auto GetSystemMemorySizeGB() -> double
//---------------------------------------------------------------------------------------------------------------------
auto TotalMemory() -> QString
{
double size = qRound(GetSystemMemorySizeGB() * 10.0) / 10.0;
double const size = qRound(GetSystemMemorySizeGB() * 10.0) / 10.0;
return !qFuzzyCompare(size, -1.0) ? QStringLiteral("%1 GB").arg(size) : QStringLiteral("Unknown RAM");
}
} // namespace
@ -262,7 +262,7 @@ void VGAnalytics::SendAppStartEvent(qint64 engagementTimeMsec)
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SendAppCloseEvent(qint64 engagementTimeMsec)
{
QHash<QString, QJsonValue> params{
QHash<QString, QJsonValue> const params{
// {QStringLiteral("category"), ""},
// In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id
// must be supplied as part of the params for an event.
@ -289,7 +289,7 @@ void VGAnalytics::SendAppCloseEvent(qint64 engagementTimeMsec)
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SendPatternToolUsedEvent(qint64 engagementTimeMsec, const QString &toolName)
{
QHash<QString, QJsonValue> params{
QHash<QString, QJsonValue> const params{
// {QStringLiteral("category"), ""},
// In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id
// must be supplied as part of the params for an event.
@ -304,7 +304,7 @@ void VGAnalytics::SendPatternToolUsedEvent(qint64 engagementTimeMsec, const QStr
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SendPatternFormatVersion(qint64 engagementTimeMsec, const QString &version)
{
QHash<QString, QJsonValue> params{
QHash<QString, QJsonValue> const params{
// In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id
// must be supplied as part of the params for an event.
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports
@ -318,7 +318,7 @@ void VGAnalytics::SendPatternFormatVersion(qint64 engagementTimeMsec, const QStr
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SendIndividualMeasurementsFormatVersion(qint64 engagementTimeMsec, const QString &version)
{
QHash<QString, QJsonValue> params{
QHash<QString, QJsonValue> const params{
// In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id
// must be supplied as part of the params for an event.
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports
@ -332,7 +332,7 @@ void VGAnalytics::SendIndividualMeasurementsFormatVersion(qint64 engagementTimeM
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SendMultisizeMeasurementsFormatVersion(qint64 engagementTimeMsec, const QString &version)
{
QHash<QString, QJsonValue> params{
QHash<QString, QJsonValue> const params{
// In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id
// must be supplied as part of the params for an event.
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports
@ -346,7 +346,7 @@ void VGAnalytics::SendMultisizeMeasurementsFormatVersion(qint64 engagementTimeMs
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SendLayoutFormatVersion(qint64 engagementTimeMsec, const QString &version)
{
QHash<QString, QJsonValue> params{
QHash<QString, QJsonValue> const params{
// In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id
// must be supplied as part of the params for an event.
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports
@ -439,7 +439,7 @@ auto VGAnalytics::InitAppStartEventParams(qint64 engagementTimeMsec) const -> QH
auto VGAnalytics::CountryCode() -> QString
{
QNetworkAccessManager manager;
QNetworkRequest request(QUrl(QStringLiteral("https://api.country.is")));
QNetworkRequest const request(QUrl(QStringLiteral("https://api.country.is")));
QNetworkReply *reply = manager.get(request);
QTimer timer;
@ -460,9 +460,9 @@ auto VGAnalytics::CountryCode() -> QString
// The API response was received before the timeout
if (reply->error() == QNetworkReply::NoError)
{
QByteArray responseData = reply->readAll();
QByteArray const responseData = reply->readAll();
QJsonParseError error;
QJsonDocument jsonDoc = QJsonDocument::fromJson(responseData, &error);
QJsonDocument const jsonDoc = QJsonDocument::fromJson(responseData, &error);
if (error.error == QJsonParseError::NoError && jsonDoc.isObject())
{

View File

@ -67,12 +67,12 @@ VGAnalyticsWorker::VGAnalyticsWorker(QObject *parent)
m_screensNumber = QString::number(QGuiApplication::screens().size());
QScreen *screen = QGuiApplication::primaryScreen();
QSize logicalSize = screen->size();
qreal devicePixelRatio = screen->devicePixelRatio();
QSize const logicalSize = screen->size();
qreal const devicePixelRatio = screen->devicePixelRatio();
m_screenPixelRatio = QString::number(devicePixelRatio);
int screenWidth = qRound(logicalSize.width() * devicePixelRatio);
int screenHeight = qRound(logicalSize.height() * devicePixelRatio);
int const screenWidth = qRound(logicalSize.width() * devicePixelRatio);
int const screenHeight = qRound(logicalSize.height() * devicePixelRatio);
m_screenResolution = QStringLiteral("%1x%2").arg(screenWidth).arg(screenHeight);
m_screenScaleFactor = screen->logicalDotsPerInchX() / 96.0;
@ -159,17 +159,17 @@ void VGAnalyticsWorker::ReadMessagesFromFile(const QList<QString> &dataList)
QListIterator<QString> iter(dataList);
while (iter.hasNext())
{
QString queryString = iter.next();
QString dateString = iter.next();
QDateTime dateTime = QDateTime::fromString(dateString, dateTimeFormat);
QString const queryString = iter.next();
QString const dateString = iter.next();
QDateTime const dateTime = QDateTime::fromString(dateString, dateTimeFormat);
QueryBuffer buffer;
QJsonDocument jsonDocument = QJsonDocument::fromJson(queryString.toUtf8());
QJsonDocument const jsonDocument = QJsonDocument::fromJson(queryString.toUtf8());
if (jsonDocument.isNull())
{
qDebug() << "===> please check the string " << queryString.toUtf8();
}
QJsonObject jsonObject = jsonDocument.object();
QJsonObject const jsonObject = jsonDocument.object();
buffer.postQuery = jsonObject;
buffer.time = dateTime;
@ -221,9 +221,9 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
connection = "keep-alive"_L1;
}
QueryBuffer buffer = m_messageQueue.head();
QDateTime sendTime = QDateTime::currentDateTime();
qint64 timeDiff = buffer.time.msecsTo(sendTime);
QueryBuffer const buffer = m_messageQueue.head();
QDateTime const sendTime = QDateTime::currentDateTime();
qint64 const timeDiff = buffer.time.msecsTo(sendTime);
if (timeDiff > fourHours)
{
@ -232,7 +232,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
return PostMessage();
}
QByteArray requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact);
QByteArray const requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact);
m_request.setRawHeader("Connection", connection.toUtf8());
m_request.setHeader(QNetworkRequest::ContentLengthHeader, requestJson.length());
@ -276,7 +276,7 @@ void VGAnalyticsWorker::PostMessageFinished()
{
auto *reply = qobject_cast<QNetworkReply *>(sender());
int httpStausCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
int const httpStausCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (httpStausCode < 200 || httpStausCode > 299)
{
LogMessage(VGAnalytics::Error, QStringLiteral("Error posting message: %1").arg(reply->errorString()));

View File

@ -242,7 +242,7 @@ auto VAbstractArc::GetPath() const -> QPainterPath
}
else
{
QPointF center = GetCenter().toQPointF();
QPointF const center = GetCenter().toQPointF();
QRectF rec = QRectF(center.x(), center.y(), accuracyPointOnLine * 2, accuracyPointOnLine * 2);
rec.translate(-rec.center().x(), -rec.center().y());
path.addEllipse(rec);

View File

@ -352,7 +352,7 @@ auto PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, q
//----------------------
auto BezierTailPoints = [x1234, y1234, x234, y234, x34, y34, x4, y4, level, approximationScale]()
{
QVector<QPointF> tail;
QVector<QPointF> const tail;
return PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast<qint16>(level + 1), tail,
approximationScale);
};
@ -365,7 +365,7 @@ auto PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, q
if (level < 1)
{
QFuture<QVector<QPointF>> futureBezier = QtConcurrent::run(BezierPoints);
QFuture<QVector<QPointF>> const futureBezier = QtConcurrent::run(BezierPoints);
const QVector<QPointF> tail = BezierTailPoints();
return futureBezier.result() + tail;
}

View File

@ -245,7 +245,7 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
if (p1 > 0)
{
const VSplinePoint &splP1 = points.at(p1);
QLineF line(splP1.P().toQPointF(), spl1p2);
QLineF const line(splP1.P().toQPointF(), spl1p2);
if (qFuzzyIsNull(line.length()))
{
spl1p2.rx() += ToPixel(0.1, Unit::Mm);
@ -259,7 +259,7 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
if (p2 < points.size() - 1)
{
const VSplinePoint &splP2 = points.at(p2);
QLineF line(splP2.P().toQPointF(), spl2p3);
QLineF const line(splP2.P().toQPointF(), spl2p3);
if (qFuzzyIsNull(line.length()))
{
spl2p3.rx() += ToPixel(0.1, Unit::Mm);

View File

@ -49,8 +49,8 @@ auto NodeCurvature(const QPointF &p1, const QPointF &p2, const QPointF &p3, doub
QLineF l1(p2, p1);
l1.setAngle(l1.angle() + 180);
QLineF l2(p2, p3);
double angle = qDegreesToRadians(l2.angleTo(l1));
QLineF const l2(p2, p3);
double const angle = qDegreesToRadians(l2.angleTo(l1));
return qSin(angle / 2.0) / length;
}
@ -58,12 +58,12 @@ auto NodeCurvature(const QPointF &p1, const QPointF &p2, const QPointF &p3, doub
//---------------------------------------------------------------------------------------------------------------------
auto MinimalLength(const QVector<QPointF> &points) -> double
{
vsizetype numPoints = points.size();
vsizetype const numPoints = points.size();
double smallestDistance = std::numeric_limits<double>::max();
for (int i = 0; i < numPoints - 1; ++i)
{
double distance = QLineF(points[i], points[i + 1]).length();
double const distance = QLineF(points[i], points[i + 1]).length();
if (!qFuzzyIsNull(distance))
{
smallestDistance = std::min(smallestDistance, distance);
@ -649,14 +649,14 @@ void VAbstractCurve::SetAliasSuffix(const QString &aliasSuffix)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::Curvature(const QVector<QPointF> &vertices) -> double
{
vsizetype numVertices = vertices.size();
vsizetype const numVertices = vertices.size();
if (numVertices < 3)
{
// A polygonal chain needs at least 3 vertices
return 0.0;
}
qreal minLength = MinimalLength(vertices);
qreal const minLength = MinimalLength(vertices);
double sumCurvature = 0.0;
for (vsizetype i = 1; i < vertices.size() - 1; ++i)

View File

@ -237,7 +237,7 @@ auto VArc::GetLength() const -> qreal
*/
auto VArc::GetP1() const -> QPointF
{
QPointF p1(GetCenter().x() + qAbs(d->radius), GetCenter().y());
QPointF const p1(GetCenter().x() + qAbs(d->radius), GetCenter().y());
QLineF centerP1(static_cast<QPointF>(GetCenter()), p1);
centerP1.setAngle(GetStartAngle());
return centerP1.p2();
@ -250,7 +250,7 @@ auto VArc::GetP1() const -> QPointF
*/
auto VArc::GetP2() const -> QPointF
{
QPointF p2(GetCenter().x() + qAbs(d->radius), GetCenter().y());
QPointF const p2(GetCenter().x() + qAbs(d->radius), GetCenter().y());
QLineF centerP2(static_cast<QPointF>(GetCenter()), p2);
centerP2.setAngle(GetEndAngle());
return centerP2.p2();
@ -381,7 +381,7 @@ auto VArc::CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName
return GetP2();
}
QLineF line =
QLineF const line =
not IsFlipped() ? CutPoint(length, fullLength, pointName) : CutPointFlipped(length, fullLength, pointName);
arc1 = VArc(GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), line.angle(),
@ -419,7 +419,7 @@ auto VArc::OptimalApproximationScale(qreal radius, qreal f1, qreal f2, qreal tol
{
VArc arc(VPointF(), radius, f1, f2);
arc.SetApproximationScale(scale);
qreal curvature = Curvature(arc.GetPoints());
qreal const curvature = Curvature(arc.GetPoints());
if (expectedCurvature - curvature <= expectedCurvature * tolerance)
{

View File

@ -217,7 +217,7 @@ auto VCubicBezierPath::GetSpline(vsizetype index) const -> VSpline
if (base + 1 > 1)
{
const QPointF b = static_cast<QPointF>(d->path.at(base));
QLineF foot1(b, static_cast<QPointF>(d->path.at(base - 1)));
QLineF const foot1(b, static_cast<QPointF>(d->path.at(base - 1)));
QLineF foot2(b, p2);
foot2.setAngle(foot1.angle() + 180);

View File

@ -67,12 +67,12 @@ auto VLen(fpm::fixed_16_16 x, fpm::fixed_16_16 y) -> fpm::fixed_16_16
//---------------------------------------------------------------------------------------------------------------------
auto AuxRadius(fpm::fixed_16_16 xP, fpm::fixed_16_16 yP, fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ) -> fpm::fixed_16_16
{
fpm::fixed_16_16 dP = VLen(xP, yP);
fpm::fixed_16_16 dQ = VLen(xQ, yQ);
fpm::fixed_16_16 dJ = VLen(xP + xQ, yP + yQ);
fpm::fixed_16_16 dK = VLen(xP - xQ, yP - yQ);
fpm::fixed_16_16 r1 = qMax(dP, dQ);
fpm::fixed_16_16 r2 = qMax(dJ, dK);
fpm::fixed_16_16 const dP = VLen(xP, yP);
fpm::fixed_16_16 const dQ = VLen(xQ, yQ);
fpm::fixed_16_16 const dJ = VLen(xP + xQ, yP + yQ);
fpm::fixed_16_16 const dK = VLen(xP - xQ, yP - yQ);
fpm::fixed_16_16 const r1 = qMax(dP, dQ);
fpm::fixed_16_16 const r2 = qMax(dJ, dK);
return qMax(r1 + r1 / 16, r2 - r2 / 4);
}
@ -81,7 +81,7 @@ auto AngularInc(fpm::fixed_16_16 xP, fpm::fixed_16_16 yP, fpm::fixed_16_16 xQ, f
fpm::fixed_16_16 flatness) -> int
{
fpm::fixed_16_16 r = AuxRadius(xP, yP, xQ, yQ);
fpm::fixed_16_16 const r = AuxRadius(xP, yP, xQ, yQ);
fpm::fixed_16_16 err2{r >> 3};
// 2nd-order term
fpm::fixed_16_16 err4{r >> 7};
@ -109,7 +109,7 @@ inline void CircleGen(fpm::fixed_16_16 &u, fpm::fixed_16_16 &v, uint k)
//---------------------------------------------------------------------------------------------------------------------
auto InitialValue(fpm::fixed_16_16 u0, fpm::fixed_16_16 v0, uint k) -> fpm::fixed_16_16
{
uint shift = 2 * k + 3;
uint const shift = 2 * k + 3;
fpm::fixed_16_16 w{u0 >> shift};
fpm::fixed_16_16 U0 = u0 - w + (v0 >> (k + 1));
@ -125,7 +125,7 @@ auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP,
fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ, fpm::fixed_16_16 sweep, fpm::fixed_16_16 flatness)
-> QVector<QPointF>
{
uint k = qMin(static_cast<uint>(AngularInc(xP, yP, xQ, yQ, flatness)), 16U);
uint const k = qMin(static_cast<uint>(AngularInc(xP, yP, xQ, yQ, flatness)), 16U);
const uint count = static_cast<std::uint32_t>(sweep.raw_value()) >> (16 - k);
QVector<QPointF> arc;
@ -151,8 +151,8 @@ auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP,
auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qreal asweep, qreal approximationScale)
-> QVector<QPointF>
{
fpm::fixed_16_16 xC{c.x()};
fpm::fixed_16_16 yC{c.y()};
fpm::fixed_16_16 const xC{c.x()};
fpm::fixed_16_16 const yC{c.y()};
fpm::fixed_16_16 xP{c.x() + radius1};
fpm::fixed_16_16 yP{c.y()};
@ -168,10 +168,10 @@ auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qr
if (not qFuzzyIsNull(astart))
{
// Set new conjugate diameter end points P and Q
fpm::fixed_16_16 cosa{cos(astart)};
fpm::fixed_16_16 sina{sin(astart)};
fpm::fixed_16_16 x{xP * cosa + xQ * sina};
fpm::fixed_16_16 y{yP * cosa + yQ * sina};
fpm::fixed_16_16 const cosa{cos(astart)};
fpm::fixed_16_16 const sina{sin(astart)};
fpm::fixed_16_16 const x{xP * cosa + xQ * sina};
fpm::fixed_16_16 const y{yP * cosa + yQ * sina};
xQ = xQ * cosa - xP * sina;
yQ = yQ * cosa - yP * sina;
@ -192,13 +192,13 @@ auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qr
approximationScale = VAbstractApplication::VApp()->Settings()->GetCurveApproximationScale();
}
fpm::fixed_16_16 flatness{maxCurveApproximationScale / approximationScale * tolerance};
fpm::fixed_16_16 swangle{asweep};
fpm::fixed_16_16 const flatness{maxCurveApproximationScale / approximationScale * tolerance};
fpm::fixed_16_16 const swangle{asweep};
QVector<QPointF> arc = EllipseCore(xC, yC, xP, yP, xQ, yQ, swangle, flatness);
// Arc end point
fpm::fixed_16_16 cosb{qCos(asweep)};
fpm::fixed_16_16 sinb{qSin(asweep)};
fpm::fixed_16_16 const cosb{qCos(asweep)};
fpm::fixed_16_16 const sinb{qSin(asweep)};
xP = xP * cosb + xQ * sinb;
yP = yP * cosb + yQ * sinb;
arc.append({static_cast<qreal>(xP + xC), static_cast<qreal>(yP + yC)});
@ -491,7 +491,7 @@ auto VEllipticalArc::GetPoints() const -> QVector<QPointF>
Q_RELAXED_CONSTEXPR qreal threshold = ToPixel(0.001, Unit::Mm);
qreal radius1 = qMax(qAbs(d->radius1), threshold);
qreal radius2 = qMax(qAbs(d->radius2), threshold);
qreal max = qMax(qAbs(d->radius1), qAbs(d->radius2));
qreal const max = qMax(qAbs(d->radius1), qAbs(d->radius2));
qreal scale = 1;
if (max > maxRadius)
@ -581,7 +581,7 @@ auto VEllipticalArc::CutArc(qreal length, VEllipticalArc &arc1, VEllipticalArc &
return GetP2();
}
qreal len = CorrectCutLength(length, fullLength, pointName);
qreal const len = CorrectCutLength(length, fullLength, pointName);
// the first arc has given length and startAngle just like in the origin arc
arc1 = VEllipticalArc(len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1,
@ -662,7 +662,7 @@ void VEllipticalArc::FindF2(qreal length)
// We need to calculate the second angle
// first approximation of angle between start and end angles
VPointF center = GetCenter();
VPointF const center = GetCenter();
QLineF radius1(center.x(), center.y(), center.x() + qAbs(d->radius1), center.y());
radius1.setAngle(GetStartAngle());
radius1.setAngle(radius1.angle() + gap);
@ -732,7 +732,7 @@ auto VEllipticalArc::GetP(qreal angle) const -> QPointF
return GetCenter().toQPointF();
}
QPointF p(line.p2().x() / k, line.p2().y() / k);
QPointF const p(line.p2().x() / k, line.p2().y() / k);
QLineF line2(QPointF(), p);
SCASSERT(VFuzzyComparePossibleNulls(line2.angle(), line.angle()))
@ -749,8 +749,8 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
return points;
}
QPointF center = VAbstractArc::GetCenter().toQPointF();
qreal radius = qMax(qAbs(d->radius1), qAbs(d->radius2)) * 2;
QPointF const center = VAbstractArc::GetCenter().toQPointF();
qreal const radius = qMax(qAbs(d->radius1), qAbs(d->radius2)) * 2;
QLineF start(center.x(), center.y(), center.x() + radius, center.y());
start.setAngle(VAbstractArc::GetStartAngle());
@ -764,15 +764,15 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
{
for (int i = 0; i < points.size() - 1; ++i)
{
QLineF edge(points.at(i), points.at(i + 1));
QLineF const edge(points.at(i), points.at(i + 1));
QPointF p;
QLineF::IntersectType type = start.intersects(edge, &p);
QLineF::IntersectType const type = start.intersects(edge, &p);
// QLineF::intersects not always accurate on edge cases
if (IsBoundedIntersection(type, p, edge, start))
{
QVector<QPointF> head = points.mid(0, i + 1);
QVector<QPointF> const head = points.mid(0, i + 1);
QVector<QPointF> tail = points.mid(i + 1, -1);
tail = JoinVectors({p}, tail);
@ -795,12 +795,12 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
for (int i = 0; i < points.size() - 1; ++i)
{
QLineF edge(points.at(i), points.at(i + 1));
QLineF const edge(points.at(i), points.at(i + 1));
if (begin)
{
QPointF p;
QLineF::IntersectType type = start.intersects(edge, &p);
QLineF::IntersectType const type = start.intersects(edge, &p);
// QLineF::intersects not always accurate on edge cases
if (IsBoundedIntersection(type, p, edge, start))
@ -812,7 +812,7 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
else
{
QPointF p;
QLineF::IntersectType type = end.intersects(edge, &p);
QLineF::IntersectType const type = end.intersects(edge, &p);
// QLineF::intersects not always accurate on edge cases
if (IsBoundedIntersection(type, p, edge, end))

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