From 64029c249a91c708f1fb0d5ecad633f86007a14c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 8 Apr 2018 19:45:23 +0300 Subject: [PATCH] Refactoring. Added special section for string literals. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 4 +- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/libs/vmisc/def.cpp | 2 - src/libs/vmisc/def.h | 2 +- src/libs/vmisc/literals.cpp | 33 ++++++++++ src/libs/vmisc/literals.h | 38 +++++++++++ src/libs/vmisc/vmisc.pri | 6 +- .../dialogs/tools/dialogcubicbezierpath.cpp | 2 +- .../vtools/dialogs/tools/dialogsplinepath.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogtool.cpp | 7 +- src/libs/vtools/dialogs/tools/dialogtool.h | 2 +- .../tools/piece/dialogseamallowance.cpp | 66 +++++++++---------- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 10 +-- .../tst_tslocaletranslation.cpp | 19 +++--- 14 files changed, 135 insertions(+), 60 deletions(-) create mode 100644 src/libs/vmisc/literals.cpp create mode 100644 src/libs/vmisc/literals.h diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index d86868359..9f8a091a3 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -553,9 +553,9 @@ void TMainWindow::changeEvent(QEvent *event) if (mType == MeasurementsType::Multisize) { ui->labelMType->setText(tr("Multisize measurements")); - ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QLatin1String(" ") + + ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QChar(QChar::Space) + UnitsToStr(m->MUnit(), true)); - ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QLatin1String(" ") + + ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QChar(QChar::Space) + UnitsToStr(m->MUnit(), true)); labelGradationHeights = new QLabel(tr("Height:")); diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 06f913970..cf418a95c 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -949,7 +949,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, QGraphicsRectItem *paper, QG bool ignorePrinterFields, const QMarginsF &margins) const { QPrinter printer; - printer.setCreator(QGuiApplication::applicationDisplayName()+QLatin1String(" ")+ + printer.setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+ QCoreApplication::applicationVersion()); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(name); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index d3f1ef8bc..fca70e13c 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -581,8 +581,6 @@ void ShowInGraphicalShell(const QString &filePath) } -const QString LONG_OPTION_NO_HDPI_SCALING = QStringLiteral("no-scaling"); - //--------------------------------------------------------------------------------------------------------------------- bool IsOptionSet(int argc, char *argv[], const char *option) { diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index ebe3ab1fe..3fd67259b 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -40,6 +40,7 @@ #include #endif /* Q_OS_WIN */ +#include "literals.h" #include "debugbreak.h" #include "defglobal.h" @@ -316,7 +317,6 @@ enum class GSizes : unsigned char { ALL, # define V_FALLTHROUGH #endif -extern const QString LONG_OPTION_NO_HDPI_SCALING; bool IsOptionSet(int argc, char *argv[], const char *option); void InitHighDpiScaling(int argc, char *argv[]); diff --git a/src/libs/vmisc/literals.cpp b/src/libs/vmisc/literals.cpp new file mode 100644 index 000000000..6f2917abd --- /dev/null +++ b/src/libs/vmisc/literals.cpp @@ -0,0 +1,33 @@ +/************************************************************************ + ** + ** @file literals.cpp + ** @author Roman Telezhynskyi + ** @date 8 4, 2018 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2018 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#include "literals.h" + +const QString LONG_OPTION_NO_HDPI_SCALING = QStringLiteral("no-scaling"); + +const QString editDeleteIcon = QStringLiteral("edit-delete"); +const QString preferencesOtherIcon = QStringLiteral("preferences-other"); diff --git a/src/libs/vmisc/literals.h b/src/libs/vmisc/literals.h new file mode 100644 index 000000000..b21ad0679 --- /dev/null +++ b/src/libs/vmisc/literals.h @@ -0,0 +1,38 @@ +/************************************************************************ + ** + ** @file literals.h + ** @author Roman Telezhynskyi + ** @date 8 4, 2018 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2018 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef LITERALS_H +#define LITERALS_H + +#include + +extern const QString LONG_OPTION_NO_HDPI_SCALING; + +extern const QString editDeleteIcon; +extern const QString preferencesOtherIcon; + +#endif // LITERALS_H diff --git a/src/libs/vmisc/vmisc.pri b/src/libs/vmisc/vmisc.pri index 46605a9e8..8fad3378f 100644 --- a/src/libs/vmisc/vmisc.pri +++ b/src/libs/vmisc/vmisc.pri @@ -12,7 +12,8 @@ SOURCES += \ $$PWD/qxtcsvmodel.cpp \ $$PWD/vtablesearch.cpp \ $$PWD/dialogs/dialogexporttocsv.cpp \ - $$PWD/defglobal.cpp + $$PWD/defglobal.cpp \ + $$PWD/literals.cpp *msvc*:SOURCES += $$PWD/stable.cpp @@ -37,7 +38,8 @@ HEADERS += \ $$PWD/customevents.h \ $$PWD/defglobal.h \ $$PWD/backport/qoverload.h \ - $$PWD/testvapplication.h + $$PWD/testvapplication.h \ + $$PWD/literals.h # Qt's versions # 5.2.0, 5.2.1 diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp index 280dd1771..17143dd4a 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp @@ -266,7 +266,7 @@ void DialogCubicBezierPath::currentPointChanged(int index) void DialogCubicBezierPath::NewItem(const VPointF &point) { auto item = new QListWidgetItem(point.name()); - item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFont(NodeFont(item->font())); item->setData(Qt::UserRole, QVariant::fromValue(point)); ui->listWidget->addItem(item); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index 9f1b070f4..210677775 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -724,7 +724,7 @@ void DialogSplinePath::NewItem(const VSplinePoint &point) flagLength2.append(true); auto item = new QListWidgetItem(point.P().name()); - item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFont(NodeFont(item->font())); item->setData(Qt::UserRole, QVariant::fromValue(point)); ui->listWidget->addItem(item); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index d49ce8812..890648c81 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -601,9 +601,10 @@ QString DialogTool::DialogWarningIcon() } //--------------------------------------------------------------------------------------------------------------------- -QFont DialogTool::NodeFont(bool nodeExcluded) +QFont DialogTool::NodeFont(QFont font, bool nodeExcluded) { - QFont font("Times", 12, QFont::Bold); + font.setPointSize(12); + font.setWeight(QFont::Bold); font.setStrikeOut(nodeExcluded); return font; } @@ -696,7 +697,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node) if(canAddNewPoint) { QListWidgetItem *item = new QListWidgetItem(name); - item->setFont(NodeFont(node.IsExcluded())); + item->setFont(NodeFont(item->font(), node.IsExcluded())); item->setData(Qt::UserRole, QVariant::fromValue(node)); listWidget->addItem(item); listWidget->setCurrentRow(listWidget->count()-1); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index ec1c62c65..830ee4b6a 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -276,7 +276,7 @@ protected: static bool DoublePoints(QListWidget *listWidget, const VContainer *data); static bool EachPointLabelIsUnique(QListWidget *listWidget); static QString DialogWarningIcon(); - static QFont NodeFont(bool nodeExcluded); + static QFont NodeFont(QFont font, bool nodeExcluded = false); QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const; void NewNodeItem(QListWidget *listWidget, const VPieceNode &node); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index bb86b8d7d..6b781b5fb 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -226,7 +226,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) const QString name = GetPathName(record.path, record.reverse); QListWidgetItem *item = new QListWidgetItem(name); - item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFont(NodeFont(item->font())); item->setData(Qt::UserRole, QVariant::fromValue(record)); uiTabPaths->listWidgetCustomSA->addItem(item); uiTabPaths->listWidgetCustomSA->setCurrentRow(uiTabPaths->listWidgetCustomSA->count()-1); @@ -243,7 +243,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) const QString name = GetPathName(path); QListWidgetItem *item = new QListWidgetItem(name); - item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFont(NodeFont(item->font())); item->setData(Qt::UserRole, QVariant::fromValue(path)); uiTabPaths->listWidgetInternalPaths->addItem(item); uiTabPaths->listWidgetInternalPaths->setCurrentRow(uiTabPaths->listWidgetInternalPaths->count()-1); @@ -259,7 +259,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) const QSharedPointer p = data->GetGObject(point); QListWidgetItem *item = new QListWidgetItem(p->name()); - item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFont(NodeFont(item->font())); item->setData(Qt::UserRole, QVariant::fromValue(point)); listWidget->addItem(item); listWidget->setCurrentRow(uiTabPins->listWidgetPins->count()-1); @@ -491,7 +491,7 @@ void DialogSeamAllowance::CheckState() } else { - m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*'); const QIcon icon = QIcon::fromTheme("dialog-warning", QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon); @@ -506,15 +506,15 @@ void DialogSeamAllowance::CheckState() QString tooltip = tr("Ready!"); if (not applyAllowed) { - tooltip = tooltip + QLatin1String(" ") + - tr("To open all detail's features complete creating the main path.") + QLatin1String(""); + tooltip = tooltip + QStringLiteral(" ") + + tr("To open all detail's features complete creating the main path.") + QStringLiteral(""); } uiTabPaths->helpLabel->setText(tooltip); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), QIcon()); } else { - m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*'); const QIcon icon = QIcon::fromTheme("dialog-warning", QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon); @@ -537,7 +537,7 @@ void DialogSeamAllowance::closeEvent(QCloseEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::showEvent(QShowEvent *event) { - QDialog::showEvent( event ); + QDialog::showEvent( event ); // clazy:exclude=skipped-base-method if ( event->spontaneous() ) { return; @@ -630,7 +630,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) actionExcluded->setCheckable(true); actionExcluded->setChecked(rowNode.IsExcluded()); - QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); QAction *selectedAction = menu->exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) @@ -648,7 +648,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) rowNode.SetExcluded(not rowNode.IsExcluded()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setText(GetNodeName(rowNode, true)); - rowItem->setFont(NodeFont(rowNode.IsExcluded())); + rowItem->setFont(NodeFont(rowItem->font(), rowNode.IsExcluded())); } else if (selectedAction == actionPassmark) { @@ -677,7 +677,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) } QScopedPointer menu(new QMenu()); - QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); + QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options")); QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); @@ -687,7 +687,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) actionReverse->setCheckable(true); actionReverse->setChecked(record.reverse); - QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); QAction *selectedAction = menu->exec(uiTabPaths->listWidgetCustomSA->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) @@ -729,8 +729,8 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos) } QScopedPointer menu(new QMenu()); - QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); - QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options")); + QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); QAction *selectedAction = menu->exec(uiTabPaths->listWidgetInternalPaths->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) @@ -764,7 +764,7 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) } QScopedPointer menu(new QMenu()); - QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); QAction *selectedAction = menu->exec(uiTabPins->listWidgetPins->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) @@ -814,7 +814,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos) UpdateCurrentPlaceLabelRecords(); }; - QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); + QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options")); menu->addSeparator(); QAction *actionSegment = InitAction(tr("Segment"), PlaceLabelType::Segment); QAction *actionRectangle = InitAction(tr("Rectangle"), PlaceLabelType::Rectangle); @@ -826,7 +826,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos) QAction *actionHshaped = InitAction(tr("H-shaped"), PlaceLabelType::Hshaped); QAction *actionButton = InitAction(tr("Button"), PlaceLabelType::Button); menu->addSeparator(); - QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); QAction *selectedAction = menu->exec(uiTabPlaceLabels->listWidgetPlaceLabels->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) @@ -1537,7 +1537,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() { plbVal = uiTabGrainline->labelLen; plbText = uiTabGrainline->labelEditLen; - qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); } plbVal->setToolTip(tr("Value")); @@ -1581,7 +1581,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() flagGFormulas = bFormulasOK[0] && bFormulasOK[1]; if (not flagGFormulas && not flagGPin) { - m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline") + '*'); } else { @@ -1606,13 +1606,13 @@ void DialogSeamAllowance::UpdateDetailLabelValues() { plbVal = uiTabLabels->labelDLWidth; plbText = uiTabLabels->labelEditDLWidth; - qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); } else if (i == 1) { plbVal = uiTabLabels->labelDLHeight; plbText = uiTabLabels->labelEditDLHeight; - qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); } else { @@ -1664,7 +1664,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues() flagDLFormulas = bFormulasOK[0] && bFormulasOK[1]; if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin)) { - m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*'); const QIcon icon = QIcon::fromTheme("dialog-warning", QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); @@ -1692,13 +1692,13 @@ void DialogSeamAllowance::UpdatePatternLabelValues() { plbVal = uiTabLabels->labelPLWidth; plbText = uiTabLabels->labelEditPLWidth; - qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); } else if (i == 1) { plbVal = uiTabLabels->labelPLHeight; plbText = uiTabLabels->labelEditPLHeight; - qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); } else { @@ -1749,7 +1749,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues() flagPLFormulas = bFormulasOK[0] && bFormulasOK[1]; if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin)) { - m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*'); const QIcon icon = QIcon::fromTheme("dialog-warning", QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); @@ -2247,7 +2247,7 @@ void DialogSeamAllowance::DetailPinPointChanged() flagDPin = false; topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor; - m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*'); const QIcon icon = QIcon::fromTheme("dialog-warning", QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); @@ -2280,7 +2280,7 @@ void DialogSeamAllowance::PatternPinPointChanged() flagPPin = false; topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor; - m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*'); const QIcon icon = QIcon::fromTheme("dialog-warning", QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); @@ -2374,7 +2374,7 @@ QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const if (reverse) { - name = QLatin1String("- ") + name; + name = QStringLiteral("- ") + name; } } @@ -2783,7 +2783,7 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box) } box->clear(); - box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID); + box->addItem('<' + tr("no pin") + '>', NULL_ID); const QVector pins = GetListInternals(uiTabPins->listWidgetPins); @@ -3073,7 +3073,7 @@ void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula) { if (angleFormula.isEmpty()) { - angleFormula = QString("0"); + angleFormula = '0'; } const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator()); @@ -3152,7 +3152,7 @@ void DialogSeamAllowance::SetDLAngle(QString angleFormula) { if (angleFormula.isEmpty()) { - angleFormula = QString("0"); + angleFormula = '0'; } const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator()); @@ -3212,7 +3212,7 @@ void DialogSeamAllowance::SetPLAngle(QString angleFormula) { if (angleFormula.isEmpty()) { - angleFormula = QString("0"); + angleFormula = '0'; } const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator()); @@ -3296,7 +3296,7 @@ QString DialogSeamAllowance::GetDefaultPieceName() const while(names.contains(name)) { - name = defName + QString("_%1").arg(++i); + name = defName + QStringLiteral("_%1").arg(++i); } return name; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 457c96577..a855ced6b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -271,15 +271,15 @@ QString VToolCutArc::MakeToolTip() const " %4: %5 %3 " " %6: %7° " " %8: %9° ") - .arg(arcStr + arcNumber + QLatin1String(" ") + lengthStr) + .arg(arcStr + arcNumber + QChar(QChar::Space) + lengthStr) .arg(qApp->fromPixel(arc.GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), arcStr + arcNumber + QLatin1String(" ") + radiusStr) + .arg(UnitsToStr(qApp->patternUnit(), true), arcStr + arcNumber + QChar(QChar::Space) + radiusStr) .arg(qApp->fromPixel(arc.GetRadius())) - .arg(arcStr + arcNumber + QLatin1String(" ") + startAngleStr) + .arg(arcStr + arcNumber + QChar(QChar::Space) + startAngleStr) .arg(qApp->fromPixel(arc.GetStartAngle())) - .arg(arcStr + arcNumber + QLatin1String(" ") + endAngleStr) + .arg(arcStr + arcNumber + QChar(QChar::Space) + endAngleStr) .arg(qApp->fromPixel(arc.GetEndAngle())) - .arg(arcStr + arcNumber + QLatin1String(" ") + tr("label"), arc.name()); + .arg(arcStr + arcNumber + QChar(QChar::Space) + tr("label"), arc.name()); return toolTip; }; diff --git a/src/test/TranslationsTest/tst_tslocaletranslation.cpp b/src/test/TranslationsTest/tst_tslocaletranslation.cpp index f6674907e..0c0f52d40 100644 --- a/src/test/TranslationsTest/tst_tslocaletranslation.cpp +++ b/src/test/TranslationsTest/tst_tslocaletranslation.cpp @@ -196,14 +196,17 @@ void TST_TSLocaleTranslation::TestPunctuation() QFETCH(QString, source); QFETCH(QString, translation); - static const QStringList punctuation = QStringList() << QLatin1String(".") - << QLatin1String(":") - << QLatin1String(" ") - << QLatin1String("\n") - << QLatin1String("!") - << QLatin1String("?") - << QLatin1String(";") - << "…"; + static const QStringList punctuation{ + QChar('.'), + QChar(':'), + QChar(QChar::Space), + QChar('\n'), + QChar('!'), + QChar('?'), + QChar(';'), + QChar(0x2026)//… + }; + bool testFail = false; const QChar cSource = source.at(source.length()-1); QChar cPunctuation = cSource;