Refactoring. Added special section for string literals.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-08 19:45:23 +03:00
parent 00f9139150
commit 64029c249a
14 changed files with 135 additions and 60 deletions

View File

@ -553,9 +553,9 @@ void TMainWindow::changeEvent(QEvent *event)
if (mType == MeasurementsType::Multisize) if (mType == MeasurementsType::Multisize)
{ {
ui->labelMType->setText(tr("Multisize measurements")); 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)); 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)); UnitsToStr(m->MUnit(), true));
labelGradationHeights = new QLabel(tr("Height:")); labelGradationHeights = new QLabel(tr("Height:"));

View File

@ -949,7 +949,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, QGraphicsRectItem *paper, QG
bool ignorePrinterFields, const QMarginsF &margins) const bool ignorePrinterFields, const QMarginsF &margins) const
{ {
QPrinter printer; QPrinter printer;
printer.setCreator(QGuiApplication::applicationDisplayName()+QLatin1String(" ")+ printer.setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
QCoreApplication::applicationVersion()); QCoreApplication::applicationVersion());
printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(name); printer.setOutputFileName(name);

View File

@ -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) bool IsOptionSet(int argc, char *argv[], const char *option)
{ {

View File

@ -40,6 +40,7 @@
#include <windows.h> #include <windows.h>
#endif /* Q_OS_WIN */ #endif /* Q_OS_WIN */
#include "literals.h"
#include "debugbreak.h" #include "debugbreak.h"
#include "defglobal.h" #include "defglobal.h"
@ -316,7 +317,6 @@ enum class GSizes : unsigned char { ALL,
# define V_FALLTHROUGH # define V_FALLTHROUGH
#endif #endif
extern const QString LONG_OPTION_NO_HDPI_SCALING;
bool IsOptionSet(int argc, char *argv[], const char *option); bool IsOptionSet(int argc, char *argv[], const char *option);
void InitHighDpiScaling(int argc, char *argv[]); void InitHighDpiScaling(int argc, char *argv[]);

View File

@ -0,0 +1,33 @@
/************************************************************************
**
** @file literals.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#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");

38
src/libs/vmisc/literals.h Normal file
View File

@ -0,0 +1,38 @@
/************************************************************************
**
** @file literals.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef LITERALS_H
#define LITERALS_H
#include <QString>
extern const QString LONG_OPTION_NO_HDPI_SCALING;
extern const QString editDeleteIcon;
extern const QString preferencesOtherIcon;
#endif // LITERALS_H

View File

@ -12,7 +12,8 @@ SOURCES += \
$$PWD/qxtcsvmodel.cpp \ $$PWD/qxtcsvmodel.cpp \
$$PWD/vtablesearch.cpp \ $$PWD/vtablesearch.cpp \
$$PWD/dialogs/dialogexporttocsv.cpp \ $$PWD/dialogs/dialogexporttocsv.cpp \
$$PWD/defglobal.cpp $$PWD/defglobal.cpp \
$$PWD/literals.cpp
*msvc*:SOURCES += $$PWD/stable.cpp *msvc*:SOURCES += $$PWD/stable.cpp
@ -37,7 +38,8 @@ HEADERS += \
$$PWD/customevents.h \ $$PWD/customevents.h \
$$PWD/defglobal.h \ $$PWD/defglobal.h \
$$PWD/backport/qoverload.h \ $$PWD/backport/qoverload.h \
$$PWD/testvapplication.h $$PWD/testvapplication.h \
$$PWD/literals.h
# Qt's versions # Qt's versions
# 5.2.0, 5.2.1 # 5.2.0, 5.2.1

View File

@ -266,7 +266,7 @@ void DialogCubicBezierPath::currentPointChanged(int index)
void DialogCubicBezierPath::NewItem(const VPointF &point) void DialogCubicBezierPath::NewItem(const VPointF &point)
{ {
auto item = new QListWidgetItem(point.name()); 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)); item->setData(Qt::UserRole, QVariant::fromValue(point));
ui->listWidget->addItem(item); ui->listWidget->addItem(item);

View File

@ -724,7 +724,7 @@ void DialogSplinePath::NewItem(const VSplinePoint &point)
flagLength2.append(true); flagLength2.append(true);
auto item = new QListWidgetItem(point.P().name()); 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)); item->setData(Qt::UserRole, QVariant::fromValue(point));
ui->listWidget->addItem(item); ui->listWidget->addItem(item);

View File

@ -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); font.setStrikeOut(nodeExcluded);
return font; return font;
} }
@ -696,7 +697,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
if(canAddNewPoint) if(canAddNewPoint)
{ {
QListWidgetItem *item = new QListWidgetItem(name); QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(NodeFont(node.IsExcluded())); item->setFont(NodeFont(item->font(), node.IsExcluded()));
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
listWidget->addItem(item); listWidget->addItem(item);
listWidget->setCurrentRow(listWidget->count()-1); listWidget->setCurrentRow(listWidget->count()-1);

View File

@ -276,7 +276,7 @@ protected:
static bool DoublePoints(QListWidget *listWidget, const VContainer *data); static bool DoublePoints(QListWidget *listWidget, const VContainer *data);
static bool EachPointLabelIsUnique(QListWidget *listWidget); static bool EachPointLabelIsUnique(QListWidget *listWidget);
static QString DialogWarningIcon(); 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; QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const;
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node); void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);

View File

@ -226,7 +226,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
const QString name = GetPathName(record.path, record.reverse); const QString name = GetPathName(record.path, record.reverse);
QListWidgetItem *item = new QListWidgetItem(name); QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(NodeFont(item->font()));
item->setData(Qt::UserRole, QVariant::fromValue(record)); item->setData(Qt::UserRole, QVariant::fromValue(record));
uiTabPaths->listWidgetCustomSA->addItem(item); uiTabPaths->listWidgetCustomSA->addItem(item);
uiTabPaths->listWidgetCustomSA->setCurrentRow(uiTabPaths->listWidgetCustomSA->count()-1); uiTabPaths->listWidgetCustomSA->setCurrentRow(uiTabPaths->listWidgetCustomSA->count()-1);
@ -243,7 +243,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
const QString name = GetPathName(path); const QString name = GetPathName(path);
QListWidgetItem *item = new QListWidgetItem(name); QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(NodeFont(item->font()));
item->setData(Qt::UserRole, QVariant::fromValue(path)); item->setData(Qt::UserRole, QVariant::fromValue(path));
uiTabPaths->listWidgetInternalPaths->addItem(item); uiTabPaths->listWidgetInternalPaths->addItem(item);
uiTabPaths->listWidgetInternalPaths->setCurrentRow(uiTabPaths->listWidgetInternalPaths->count()-1); uiTabPaths->listWidgetInternalPaths->setCurrentRow(uiTabPaths->listWidgetInternalPaths->count()-1);
@ -259,7 +259,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
const QSharedPointer<VGObject> p = data->GetGObject(point); const QSharedPointer<VGObject> p = data->GetGObject(point);
QListWidgetItem *item = new QListWidgetItem(p->name()); 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)); item->setData(Qt::UserRole, QVariant::fromValue(point));
listWidget->addItem(item); listWidget->addItem(item);
listWidget->setCurrentRow(uiTabPins->listWidgetPins->count()-1); listWidget->setCurrentRow(uiTabPins->listWidgetPins->count()-1);
@ -491,7 +491,7 @@ void DialogSeamAllowance::CheckState()
} }
else else
{ {
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + QLatin1String("*")); m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
const QIcon icon = QIcon::fromTheme("dialog-warning", const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon);
@ -506,15 +506,15 @@ void DialogSeamAllowance::CheckState()
QString tooltip = tr("Ready!"); QString tooltip = tr("Ready!");
if (not applyAllowed) if (not applyAllowed)
{ {
tooltip = tooltip + QLatin1String(" <b>") + tooltip = tooltip + QStringLiteral(" <b>") +
tr("To open all detail's features complete creating the main path.") + QLatin1String("</b>"); tr("To open all detail's features complete creating the main path.") + QStringLiteral("</b>");
} }
uiTabPaths->helpLabel->setText(tooltip); uiTabPaths->helpLabel->setText(tooltip);
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), QIcon()); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), QIcon());
} }
else else
{ {
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + QLatin1String("*")); m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
const QIcon icon = QIcon::fromTheme("dialog-warning", const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon);
@ -537,7 +537,7 @@ void DialogSeamAllowance::closeEvent(QCloseEvent *event)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::showEvent(QShowEvent *event) void DialogSeamAllowance::showEvent(QShowEvent *event)
{ {
QDialog::showEvent( event ); QDialog::showEvent( event ); // clazy:exclude=skipped-base-method
if ( event->spontaneous() ) if ( event->spontaneous() )
{ {
return; return;
@ -630,7 +630,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
actionExcluded->setCheckable(true); actionExcluded->setCheckable(true);
actionExcluded->setChecked(rowNode.IsExcluded()); 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)); QAction *selectedAction = menu->exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos));
if (selectedAction == actionDelete) if (selectedAction == actionDelete)
@ -648,7 +648,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
rowNode.SetExcluded(not rowNode.IsExcluded()); rowNode.SetExcluded(not rowNode.IsExcluded());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true)); rowItem->setText(GetNodeName(rowNode, true));
rowItem->setFont(NodeFont(rowNode.IsExcluded())); rowItem->setFont(NodeFont(rowItem->font(), rowNode.IsExcluded()));
} }
else if (selectedAction == actionPassmark) else if (selectedAction == actionPassmark)
{ {
@ -677,7 +677,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
} }
QScopedPointer<QMenu> menu(new QMenu()); QScopedPointer<QMenu> 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); QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
SCASSERT(rowItem != nullptr); SCASSERT(rowItem != nullptr);
@ -687,7 +687,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
actionReverse->setCheckable(true); actionReverse->setCheckable(true);
actionReverse->setChecked(record.reverse); 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)); QAction *selectedAction = menu->exec(uiTabPaths->listWidgetCustomSA->viewport()->mapToGlobal(pos));
if (selectedAction == actionDelete) if (selectedAction == actionDelete)
@ -729,8 +729,8 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
} }
QScopedPointer<QMenu> menu(new QMenu()); QScopedPointer<QMenu> menu(new QMenu());
QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options"));
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete"));
QAction *selectedAction = menu->exec(uiTabPaths->listWidgetInternalPaths->viewport()->mapToGlobal(pos)); QAction *selectedAction = menu->exec(uiTabPaths->listWidgetInternalPaths->viewport()->mapToGlobal(pos));
if (selectedAction == actionDelete) if (selectedAction == actionDelete)
@ -764,7 +764,7 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos)
} }
QScopedPointer<QMenu> menu(new QMenu()); QScopedPointer<QMenu> 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)); QAction *selectedAction = menu->exec(uiTabPins->listWidgetPins->viewport()->mapToGlobal(pos));
if (selectedAction == actionDelete) if (selectedAction == actionDelete)
@ -814,7 +814,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
UpdateCurrentPlaceLabelRecords(); UpdateCurrentPlaceLabelRecords();
}; };
QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options"));
menu->addSeparator(); menu->addSeparator();
QAction *actionSegment = InitAction(tr("Segment"), PlaceLabelType::Segment); QAction *actionSegment = InitAction(tr("Segment"), PlaceLabelType::Segment);
QAction *actionRectangle = InitAction(tr("Rectangle"), PlaceLabelType::Rectangle); 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 *actionHshaped = InitAction(tr("H-shaped"), PlaceLabelType::Hshaped);
QAction *actionButton = InitAction(tr("Button"), PlaceLabelType::Button); QAction *actionButton = InitAction(tr("Button"), PlaceLabelType::Button);
menu->addSeparator(); 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)); QAction *selectedAction = menu->exec(uiTabPlaceLabels->listWidgetPlaceLabels->viewport()->mapToGlobal(pos));
if (selectedAction == actionDelete) if (selectedAction == actionDelete)
@ -1537,7 +1537,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
{ {
plbVal = uiTabGrainline->labelLen; plbVal = uiTabGrainline->labelLen;
plbText = uiTabGrainline->labelEditLen; plbText = uiTabGrainline->labelEditLen;
qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
} }
plbVal->setToolTip(tr("Value")); plbVal->setToolTip(tr("Value"));
@ -1581,7 +1581,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
flagGFormulas = bFormulasOK[0] && bFormulasOK[1]; flagGFormulas = bFormulasOK[0] && bFormulasOK[1];
if (not flagGFormulas && not flagGPin) if (not flagGFormulas && not flagGPin)
{ {
m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline") + QLatin1String("*")); m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline") + '*');
} }
else else
{ {
@ -1606,13 +1606,13 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
{ {
plbVal = uiTabLabels->labelDLWidth; plbVal = uiTabLabels->labelDLWidth;
plbText = uiTabLabels->labelEditDLWidth; plbText = uiTabLabels->labelEditDLWidth;
qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
} }
else if (i == 1) else if (i == 1)
{ {
plbVal = uiTabLabels->labelDLHeight; plbVal = uiTabLabels->labelDLHeight;
plbText = uiTabLabels->labelEditDLHeight; plbText = uiTabLabels->labelEditDLHeight;
qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
} }
else else
{ {
@ -1664,7 +1664,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
flagDLFormulas = bFormulasOK[0] && bFormulasOK[1]; flagDLFormulas = bFormulasOK[0] && bFormulasOK[1];
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin)) 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", const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
@ -1692,13 +1692,13 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
{ {
plbVal = uiTabLabels->labelPLWidth; plbVal = uiTabLabels->labelPLWidth;
plbText = uiTabLabels->labelEditPLWidth; plbText = uiTabLabels->labelEditPLWidth;
qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
} }
else if (i == 1) else if (i == 1)
{ {
plbVal = uiTabLabels->labelPLHeight; plbVal = uiTabLabels->labelPLHeight;
plbText = uiTabLabels->labelEditPLHeight; plbText = uiTabLabels->labelEditPLHeight;
qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
} }
else else
{ {
@ -1749,7 +1749,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
flagPLFormulas = bFormulasOK[0] && bFormulasOK[1]; flagPLFormulas = bFormulasOK[0] && bFormulasOK[1];
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin)) 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", const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
@ -2247,7 +2247,7 @@ void DialogSeamAllowance::DetailPinPointChanged()
flagDPin = false; flagDPin = false;
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor; 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", const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
@ -2280,7 +2280,7 @@ void DialogSeamAllowance::PatternPinPointChanged()
flagPPin = false; flagPPin = false;
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor; 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", const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png")); QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
@ -2374,7 +2374,7 @@ QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
if (reverse) if (reverse)
{ {
name = QLatin1String("- ") + name; name = QStringLiteral("- ") + name;
} }
} }
@ -2783,7 +2783,7 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box)
} }
box->clear(); box->clear();
box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID); box->addItem('<' + tr("no pin") + '>', NULL_ID);
const QVector<quint32> pins = GetListInternals<quint32>(uiTabPins->listWidgetPins); const QVector<quint32> pins = GetListInternals<quint32>(uiTabPins->listWidgetPins);
@ -3073,7 +3073,7 @@ void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
{ {
if (angleFormula.isEmpty()) if (angleFormula.isEmpty())
{ {
angleFormula = QString("0"); angleFormula = '0';
} }
const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator()); const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator());
@ -3152,7 +3152,7 @@ void DialogSeamAllowance::SetDLAngle(QString angleFormula)
{ {
if (angleFormula.isEmpty()) if (angleFormula.isEmpty())
{ {
angleFormula = QString("0"); angleFormula = '0';
} }
const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator()); const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator());
@ -3212,7 +3212,7 @@ void DialogSeamAllowance::SetPLAngle(QString angleFormula)
{ {
if (angleFormula.isEmpty()) if (angleFormula.isEmpty())
{ {
angleFormula = QString("0"); angleFormula = '0';
} }
const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator()); const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator());
@ -3296,7 +3296,7 @@ QString DialogSeamAllowance::GetDefaultPieceName() const
while(names.contains(name)) while(names.contains(name))
{ {
name = defName + QString("_%1").arg(++i); name = defName + QStringLiteral("_%1").arg(++i);
} }
return name; return name;
} }

View File

@ -271,15 +271,15 @@ QString VToolCutArc::MakeToolTip() const
"<tr> <td><b>%4:</b> %5 %3</td> </tr>" "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
"<tr> <td><b>%6:</b> %7°</td> </tr>" "<tr> <td><b>%6:</b> %7°</td> </tr>"
"<tr> <td><b>%8:</b> %9°</td> </tr>") "<tr> <td><b>%8:</b> %9°</td> </tr>")
.arg(arcStr + arcNumber + QLatin1String(" ") + lengthStr) .arg(arcStr + arcNumber + QChar(QChar::Space) + lengthStr)
.arg(qApp->fromPixel(arc.GetLength())) .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(qApp->fromPixel(arc.GetRadius()))
.arg(arcStr + arcNumber + QLatin1String(" ") + startAngleStr) .arg(arcStr + arcNumber + QChar(QChar::Space) + startAngleStr)
.arg(qApp->fromPixel(arc.GetStartAngle())) .arg(qApp->fromPixel(arc.GetStartAngle()))
.arg(arcStr + arcNumber + QLatin1String(" ") + endAngleStr) .arg(arcStr + arcNumber + QChar(QChar::Space) + endAngleStr)
.arg(qApp->fromPixel(arc.GetEndAngle())) .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; return toolTip;
}; };

View File

@ -196,14 +196,17 @@ void TST_TSLocaleTranslation::TestPunctuation()
QFETCH(QString, source); QFETCH(QString, source);
QFETCH(QString, translation); QFETCH(QString, translation);
static const QStringList punctuation = QStringList() << QLatin1String(".") static const QStringList punctuation{
<< QLatin1String(":") QChar('.'),
<< QLatin1String(" ") QChar(':'),
<< QLatin1String("\n") QChar(QChar::Space),
<< QLatin1String("!") QChar('\n'),
<< QLatin1String("?") QChar('!'),
<< QLatin1String(";") QChar('?'),
<< ""; QChar(';'),
QChar(0x2026)//…
};
bool testFail = false; bool testFail = false;
const QChar cSource = source.at(source.length()-1); const QChar cSource = source.at(source.length()-1);
QChar cPunctuation = cSource; QChar cPunctuation = cSource;