Clazy warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-03-14 15:39:15 +02:00
parent 0a27af972d
commit c1cea4c441
87 changed files with 1000 additions and 991 deletions

View File

@ -147,28 +147,33 @@ defineReplace(set_PCH){
}
defineReplace(enable_ccache){
no_ccache{ # For enable run qmake with CONFIG+=no_ccache
$$set_PCH()
*clang*:clazy {
QMAKE_CXX = clazy
export(QMAKE_CXX) # export value to global variable.
} else {
# ccache support only Unix systems.
unix:{
# This need for turn on ccache.
*g++*{
QMAKE_CC = ccache gcc
export(QMAKE_CC) # export value to global variable.
QMAKE_CXX = ccache g++
export(QMAKE_CXX) # export value to global variable.
}
*clang*{
QMAKE_CC = ccache clang
export(QMAKE_CC) # export value to global variable.
QMAKE_CXX = ccache clang++
export(QMAKE_CXX) # export value to global variable.
}
} else {
no_ccache{ # For enable run qmake with CONFIG+=no_ccache
$$set_PCH()
} else {
# ccache support only Unix systems.
unix:{
# This need for turn on ccache.
*g++*{
QMAKE_CC = ccache gcc
export(QMAKE_CC) # export value to global variable.
QMAKE_CXX = ccache g++
export(QMAKE_CXX) # export value to global variable.
}
*clang*{
QMAKE_CC = ccache clang
export(QMAKE_CC) # export value to global variable.
QMAKE_CXX = ccache clang++
export(QMAKE_CXX) # export value to global variable.
}
} else {
$$set_PCH()
}
}
}
return(true)

View File

@ -75,7 +75,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
}
//----------------------------- Measurements Editing
connect(ui->resetWarningsButton, &QPushButton::released, []()
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
{
VTapeSettings *settings = qApp->TapeSettings();

View File

@ -130,7 +130,7 @@ void DialogAboutTape::RetranslateUi()
ui->label_QT_Version->setText(buildCompatibilityString());
const QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
ui->label_Tape_Built->setText(tr("Built on %1 at %2").arg(date.toString()).arg(__TIME__));
ui->label_Tape_Built->setText(tr("Built on %1 at %2").arg(date.toString(), __TIME__));
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
"The program is provided AS IS with NO WARRANTY OF ANY "

View File

@ -182,7 +182,7 @@ QString DialogMDataBase::ImgTag(const QString &number)
{
QString imgUrl("<img src=\"wrong.png\" align=\"center\"/>"); // In case of error
const QString filePath = QString("://diagrams/%1.svg").arg(MapDiagrams(qApp->TrVars(), number));
if (QFileInfo(filePath).exists())
if (QFileInfo::exists(filePath))
{
// Load your SVG
QSvgRenderer renderer;
@ -552,10 +552,7 @@ QString DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showIma
"normal\"> %1 <br clear=\"left\"><b>%2</b>. <i>%3</i></p>"
"<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: "
"normal\">%4</p>")
.arg(imgTag)
.arg(number)
.arg(qApp->TrVars()->GuiText(name))
.arg(qApp->TrVars()->Description(name));
.arg(imgTag, number, qApp->TrVars()->GuiText(name), qApp->TrVars()->Description(name));
return text;
}

View File

@ -41,7 +41,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(schema);
Q_INIT_RESOURCE(flags);
QT_REQUIRE_VERSION(argc, argv, "5.2.0")
QT_REQUIRE_VERSION(argc, argv, "5.2.0")// clazy:exclude=qstring-arg
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();

View File

@ -215,7 +215,7 @@ bool TMainWindow::LoadFile(const QString &path)
{
if (m == nullptr)
{
if (not QFileInfo(path).exists())
if (not QFileInfo::exists(path))
{
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path)));
if (qApp->IsTestMode())
@ -876,7 +876,7 @@ bool TMainWindow::FileSaveAs()
fileName += QLatin1String(".") + suffix;
}
if (QFileInfo(fileName).exists())
if (QFileInfo::exists(fileName))
{
// Temporary try to lock the file before saving
VLockGuard<char> tmp(fileName);
@ -1595,7 +1595,7 @@ void TMainWindow::ShowMDiagram(const QString &name)
{
ui->labelDiagram->setText(QString("<html><head/><body><p align=\"center\">%1</p>"
"<p align=\"center\"><b>%2</b>. <i>%3</i></p></body></html>")
.arg(DialogMDataBase::ImgTag(number)).arg(number).arg(trv->GuiText(name)));
.arg(DialogMDataBase::ImgTag(number), number, trv->GuiText(name)));
}
// This part is very ugly, can't find better way to resize dockWidget.
ui->labelDiagram->adjustSize();
@ -2152,9 +2152,9 @@ void TMainWindow::InitWindow()
connect(ui->comboBoxPMSystem, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&TMainWindow::SavePMSystem);
connect(ui->lineEditFind, &QLineEdit::textChanged, [this] (const QString &term){search->Find(term);});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, [this] (){search->FindPrevious();});
connect(ui->toolButtonFindNext, &QToolButton::clicked, [this] (){search->FindNext();});
connect(ui->lineEditFind, &QLineEdit::textChanged, this, [this] (const QString &term){search->Find(term);});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this] (){search->FindPrevious();});
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this] (){search->FindNext();});
connect(search.data(), &VTableSearch::HasResult, this, [this] (bool state)
{
@ -2243,7 +2243,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString
{
header.remove(index-1, 100);
}
const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit);
const QString unitHeader = QString("%1 (%2)").arg(header, unit);
table->horizontalHeaderItem(column)->setText(unitHeader);
}
@ -2825,7 +2825,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
{
if (m == nullptr)
{
if (not QFileInfo(path).exists())
if (not QFileInfo::exists(path))
{
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path)));
if (qApp->IsTestMode())

View File

@ -142,28 +142,28 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
{
case QtDebugMsg:
debugdate += QString(":DEBUG:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function).arg(context.category).arg(msg);
.arg(context.function, context.category, msg);
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << msg << "\n";
break;
case QtWarningMsg:
debugdate += QString(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function).arg(context.category).arg(msg);
.arg(context.function, context.category, msg);
vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << msg << "\n";
break;
case QtCriticalMsg:
debugdate += QString(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function).arg(context.category).arg(msg);
.arg(context.function, context.category, msg);
vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << msg << "\n";
break;
case QtFatalMsg:
debugdate += QString(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function).arg(context.category).arg(msg);
.arg(context.function, context.category, msg);
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << msg << "\n";
break;
#if QT_VERSION > QT_VERSION_CHECK(5, 4, 2)
case QtInfoMsg:
debugdate += QString(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function).arg(context.category).arg(msg);
.arg(context.function, context.category, msg);
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << msg << "\n";
break;
#endif
@ -306,7 +306,7 @@ void VApplication::NewValentina(const QString &fileName)
}
else
{
const QString run = QString("\"%1\" \"%2\"").arg(QCoreApplication::applicationFilePath()).arg(fileName);
const QString run = QString("\"%1\" \"%2\"").arg(QCoreApplication::applicationFilePath(), fileName);
qCDebug(vApp, "New process with arguments. program = %s", qUtf8Printable(run));
if (QProcess::startDetached(run))
{

View File

@ -99,7 +99,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
}
//----------------------------- Pattern Editing
connect(ui->resetWarningsButton, &QPushButton::released, []()
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
{
VSettings *settings = qApp->ValentinaSettings();

View File

@ -52,7 +52,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
ui->label_QT_Version->setText(buildCompatibilityString());
QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
ui->label_Valentina_Built->setText(tr("Built on %1 at %2").arg(date.toString()).arg(__TIME__));
ui->label_Valentina_Built->setText(tr("Built on %1 at %2").arg(date.toString(), __TIME__));
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
"The program is provided AS IS with NO WARRANTY OF ANY "

View File

@ -551,14 +551,14 @@ void DialogFinalMeasurements::ShowUnits()
{
// calculated value
const QString header = ui->tableWidget->horizontalHeaderItem(1)->text();
const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit);
const QString unitHeader = QString("%1 (%2)").arg(header, unit);
ui->tableWidget->horizontalHeaderItem(1)->setText(unitHeader);
}
{
// formula
const QString header = ui->tableWidget->horizontalHeaderItem(2)->text();
const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit);
const QString unitHeader = QString("%1 (%2)").arg(header, unit);
ui->tableWidget->horizontalHeaderItem(2)->setText(unitHeader);
}
}

View File

@ -239,37 +239,33 @@ QString DialogHistory::Record(const VToolRecord &tool)
return tr("%1 - Base point").arg(PointName(tool.getId()));
case Tool::EndLine:
return tr("%1_%2 - Line from point %1 to point %2")
.arg(PointName(AttrUInt(domElem, AttrBasePoint)))
.arg(PointName(tool.getId()));
.arg(PointName(AttrUInt(domElem, AttrBasePoint)), PointName(tool.getId()));
case Tool::Line:
return tr("%1_%2 - Line from point %1 to point %2")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)));
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)));
case Tool::AlongLine:
return tr("%3 - Point along line %1_%2")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)))
.arg(PointName(tool.getId()));
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)), PointName(tool.getId()));
case Tool::ShoulderPoint:
return tr("%1 - Point of shoulder").arg(PointName(tool.getId()));
case Tool::Normal:
return tr("%3 - normal to line %1_%2")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)))
.arg(PointName(tool.getId()));
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)), PointName(tool.getId()));
case Tool::Bisector:
return tr("%4 - bisector of angle %1_%2_%3")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)))
.arg(PointName(AttrUInt(domElem, AttrThirdPoint)))
.arg(PointName(tool.getId()));
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)),
PointName(AttrUInt(domElem, AttrThirdPoint)), PointName(tool.getId()));
case Tool::LineIntersect:
return tr("%5 - intersection of lines %1_%2 and %3_%4")
.arg(PointName(AttrUInt(domElem, AttrP1Line1)))
.arg(PointName(AttrUInt(domElem, AttrP2Line1)))
.arg(PointName(AttrUInt(domElem, AttrP1Line2)))
.arg(PointName(AttrUInt(domElem, AttrP2Line2)))
.arg(PointName(tool.getId()));
.arg(PointName(AttrUInt(domElem, AttrP1Line1)),
PointName(AttrUInt(domElem, AttrP2Line1)),
PointName(AttrUInt(domElem, AttrP1Line2)),
PointName(AttrUInt(domElem, AttrP2Line2)),
PointName(tool.getId()));
case Tool::Spline:
{
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
@ -310,33 +306,32 @@ QString DialogHistory::Record(const VToolRecord &tool)
}
case Tool::PointOfContact:
return tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")
.arg(PointName(AttrUInt(domElem, AttrCenter)))
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)))
.arg(PointName(tool.getId()));
.arg(PointName(AttrUInt(domElem, AttrCenter)),
PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)),
PointName(tool.getId()));
case Tool::Height:
return tr("Point of perpendicular from point %1 to line %2_%3")
.arg(PointName(AttrUInt(domElem, AttrBasePoint)))
.arg(PointName(AttrUInt(domElem, AttrP1Line)))
.arg(PointName(AttrUInt(domElem, AttrP2Line)));
.arg(PointName(AttrUInt(domElem, AttrBasePoint)),
PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)));
case Tool::Triangle:
return tr("Triangle: axis %1_%2, points %3 and %4")
.arg(PointName(AttrUInt(domElem, AttrAxisP1)))
.arg(PointName(AttrUInt(domElem, AttrAxisP2)))
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)));
.arg(PointName(AttrUInt(domElem, AttrAxisP1)),
PointName(AttrUInt(domElem, AttrAxisP2)),
PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)));
case Tool::PointOfIntersection:
return tr("%1 - point of intersection %2 and %3")
.arg(PointName(tool.getId()))
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, AttrSecondPoint)));
.arg(PointName(tool.getId()),
PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)));
case Tool::CutArc:
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
SCASSERT(not arc.isNull())
return tr("%1 - cut %2")
.arg(PointName(tool.getId()))
.arg(arc->NameForHistory(tr("arc")));
.arg(PointName(tool.getId()), arc->NameForHistory(tr("arc")));
}
case Tool::CutSpline:
{
@ -344,8 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId);
SCASSERT(not spl.isNull())
return tr("%1 - cut %2")
.arg(PointName(tool.getId()))
.arg(spl->NameForHistory(tr("curve")));
.arg(PointName(tool.getId()), spl->NameForHistory(tr("curve")));
}
case Tool::CutSplinePath:
{
@ -354,19 +348,17 @@ QString DialogHistory::Record(const VToolRecord &tool)
data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
SCASSERT(not splPath.isNull())
return tr("%1 - cut %2")
.arg(PointName(tool.getId()))
.arg(splPath->NameForHistory(tr("curve path")));
.arg(PointName(tool.getId()), splPath->NameForHistory(tr("curve path")));
}
case Tool::LineIntersectAxis:
return tr("%1 - point of intersection line %2_%3 and axis through point %4")
.arg(PointName(tool.getId()))
.arg(PointName(AttrUInt(domElem, AttrP1Line)))
.arg(PointName(AttrUInt(domElem, AttrP2Line)))
.arg(PointName(AttrUInt(domElem, AttrBasePoint)));
.arg(PointName(tool.getId()),
PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)),
PointName(AttrUInt(domElem, AttrBasePoint)));
case Tool::CurveIntersectAxis:
return tr("%1 - point of intersection curve and axis through point %2")
.arg(PointName(tool.getId()))
.arg(PointName(AttrUInt(domElem, AttrBasePoint)));
.arg(PointName(tool.getId()), PointName(AttrUInt(domElem, AttrBasePoint)));
case Tool::PointOfIntersectionArcs:
return tr("%1 - point of arcs intersection").arg(PointName(tool.getId()));
case Tool::PointOfIntersectionCircles:
@ -379,9 +371,9 @@ QString DialogHistory::Record(const VToolRecord &tool)
return tr("%1 - point from arc and tangent").arg(PointName(tool.getId()));
case Tool::TrueDarts:
return tr("Correction the dart %1_%2_%3")
.arg(PointName(AttrUInt(domElem, AttrDartP1)))
.arg(PointName(AttrUInt(domElem, AttrDartP2)))
.arg(PointName(AttrUInt(domElem, AttrDartP2)));
.arg(PointName(AttrUInt(domElem, AttrDartP1)),
PointName(AttrUInt(domElem, AttrDartP2)),
PointName(AttrUInt(domElem, AttrDartP2)));
case Tool::EllipticalArc:
{
const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId());

View File

@ -285,7 +285,7 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS
SCASSERT(table != nullptr)
const QString header = table->horizontalHeaderItem(column)->text();
const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit);
const QString unitHeader = QString("%1 (%2)").arg(header, unit);
table->horizontalHeaderItem(column)->setText(unitHeader);
}

View File

@ -636,7 +636,7 @@ void DialogLayoutSettings::DialogAccepted()
{
WriteSettings();
}
accepted();
emit accepted();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -40,11 +40,12 @@
#include <QtDebug>
#include <QRegularExpression>
#include <QtDebug>
#include <QGlobalStatic>
#ifndef Q_OS_WIN
const QString baseFilenameRegExp = QStringLiteral("^[^/]+$");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^/]+$")))
#else
const QString baseFilenameRegExp = QStringLiteral("^[^\\:?\"*|/<>]+$");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\:?\"*|/<>]+$")))
#endif
bool DialogSaveLayout::havePdf = false;
@ -74,7 +75,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
SCASSERT(bOk != nullptr)
bOk->setEnabled(false);
ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(baseFilenameRegExp), this));
ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(*baseFilenameRegExp), this));
const QString mask = fileName+QLatin1String("_");
if (VApplication::IsGUIMode())
@ -83,7 +84,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
}
else
{
if (QRegularExpression(baseFilenameRegExp).match(mask).hasMatch())
if (QRegularExpression(*baseFilenameRegExp).match(mask).hasMatch())
{
ui->lineEditFileName->setText(mask);
}

View File

@ -46,7 +46,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(icons);
Q_INIT_RESOURCE(toolicon);
QT_REQUIRE_VERSION(argc, argv, "5.2.0")
QT_REQUIRE_VERSION(argc, argv, "5.2.0")// clazy:exclude=qstring-arg
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();

View File

@ -87,6 +87,7 @@
#include <QTextCodec>
#include <QDoubleSpinBox>
#include <QProgressBar>
#include <QGlobalStatic>
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
#include <QWinTaskbarButton>
@ -106,11 +107,14 @@ Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow")
QT_WARNING_POP
const QString autosavePrefix = QStringLiteral(".autosave");
namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, autosavePrefix, (QLatin1String(".autosave")))
// String below need for getting translation for key Ctrl
const QString strQShortcut = QStringLiteral("QShortcut"); // Context
const QString strCtrl = QStringLiteral("Ctrl"); // String
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strQShortcut, (QLatin1String("QShortcut"))) // Context
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCtrl, (QLatin1String("Ctrl"))) // String
}
//---------------------------------------------------------------------------------------------------------------------
/**
@ -282,7 +286,7 @@ void MainWindow::AddPP(const QString &PPName)
pattern->ClearCalculationGObjects();
//Create single point
ui->view->itemClicked(nullptr);//hide options previous tool
emit ui->view->itemClicked(nullptr);//hide options previous tool
const QString label = doc->GenerateLabel(LabelType::NewPatternPiece);
const QPointF startPosition = StartPositionNewPP();
@ -298,7 +302,7 @@ void MainWindow::AddPP(const QString &PPName)
initData.nameActivPP = PPName;
auto spoint = VToolBasePoint::Create(initData);
ui->view->itemClicked(spoint);
emit ui->view->itemClicked(spoint);
SetEnableTool(true);
SetEnableWidgets(true);
@ -621,7 +625,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
{
// Try to load HiDPI versions of the cursors if availible
auto cursorHidpiResource = QString(cursor).replace(".png", "@2x.png");
if (QFileInfo(cursorResource).exists())
if (QFileInfo::exists(cursorResource))
{
cursorResource = cursorHidpiResource;
}
@ -659,7 +663,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
ui->view->itemClicked(nullptr);
emit ui->view->itemClicked(nullptr);
}
else
{
@ -714,7 +718,7 @@ void MainWindow::ClosedDialog(int result)
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern));
// Do not check for nullptr! See issue #719.
ui->view->itemClicked(tool);
emit ui->view->itemClicked(tool);
}
ArrowTool(true);
}
@ -1155,7 +1159,7 @@ void MainWindow::ClosedDialogDuplicateDetail(int result)
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(VToolSeamAllowance::Duplicate(dialogTool, scene, doc));
// Do not check for nullptr! See issue #719.
ui->view->itemClicked(tool);
emit ui->view->itemClicked(tool);
}
ArrowTool(true);
}
@ -1166,7 +1170,7 @@ void MainWindow::ToolGroup(bool checked)
ToolSelectGroupObjects();
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - finish creation")
.arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData()));
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButton<DialogGroup>(checked, Tool::Group, ":/cursor/group_plus_cursor.png", tooltip,
&MainWindow::ClosedDialogGroup);
}
@ -1177,7 +1181,7 @@ void MainWindow::ToolRotation(bool checked)
ToolSelectOperationObjects();
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - confirm selection")
.arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData()));
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButtonWithApply<DialogRotation>(checked, Tool::Rotation, ":/cursor/rotation_cursor.png", tooltip,
&MainWindow::ClosedDrawDialogWithApply<VToolRotation>,
&MainWindow::ApplyDrawDialog<VToolRotation>);
@ -1189,7 +1193,7 @@ void MainWindow::ToolFlippingByLine(bool checked)
ToolSelectOperationObjects();
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - confirm selection")
.arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData()));
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButtonWithApply<DialogFlippingByLine>(checked, Tool::FlippingByLine, ":/cursor/flipping_line_cursor.png",
tooltip, &MainWindow::ClosedDrawDialogWithApply<VToolFlippingByLine>,
&MainWindow::ApplyDrawDialog<VToolFlippingByLine>);
@ -1201,7 +1205,7 @@ void MainWindow::ToolFlippingByAxis(bool checked)
ToolSelectOperationObjects();
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - confirm selection")
.arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData()));
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButtonWithApply<DialogFlippingByAxis>(checked, Tool::FlippingByAxis, ":/cursor/flipping_axis_cursor.png",
tooltip, &MainWindow::ClosedDrawDialogWithApply<VToolFlippingByAxis>,
&MainWindow::ApplyDrawDialog<VToolFlippingByAxis>);
@ -1213,7 +1217,7 @@ void MainWindow::ToolMove(bool checked)
ToolSelectOperationObjects();
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - confirm selection")
.arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData()));
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButtonWithApply<DialogMove>(checked, Tool::Move, ":/cursor/move_cursor.png", tooltip,
&MainWindow::ClosedDrawDialogWithApply<VToolMove>,
&MainWindow::ApplyDrawDialog<VToolMove>);
@ -2065,7 +2069,7 @@ void MainWindow::InitToolButtons()
toolButtonPointerList.append(ui->toolButtonPointerOperations);
toolButtonPointerList.append(ui->toolButtonPointerEllipticalArc);
for (auto pointer : toolButtonPointerList)
for (auto pointer : qAsConst(toolButtonPointerList))
{
connect(pointer, &QToolButton::clicked, this, &MainWindow::ArrowTool);
}
@ -2157,12 +2161,12 @@ void MainWindow::CancelTool()
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash
emit ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash
switch ( currentTool )
{
case Tool::Arrow:
for (auto pointer : toolButtonPointerList)
for (auto pointer : qAsConst(toolButtonPointerList))
{
pointer->setChecked(false);
}
@ -2340,7 +2344,7 @@ void MainWindow::ArrowTool(bool checked)
{
qCDebug(vMainWindow, "Arrow tool.");
CancelTool();
for (auto pointer : toolButtonPointerList)
for (auto pointer : qAsConst(toolButtonPointerList))
{
pointer->setChecked(true);
}
@ -2383,7 +2387,7 @@ void MainWindow::ArrowTool(bool checked)
}
else
{
for (auto pointer : toolButtonPointerList)
for (auto pointer : qAsConst(toolButtonPointerList))
{
pointer->setChecked(true);
}
@ -2545,7 +2549,7 @@ void MainWindow::ActionDetails(bool checked)
SaveCurrentScene();
currentScene = sceneDetails;
ui->view->itemClicked(nullptr);
emit ui->view->itemClicked(nullptr);
ui->view->setScene(currentScene);
RestoreCurrentScene();
@ -2660,7 +2664,7 @@ void MainWindow::ActionLayout(bool checked)
}
currentScene = tempSceneLayout;
ui->view->itemClicked(nullptr);
emit ui->view->itemClicked(nullptr);
ui->view->setScene(currentScene);
if (mode == Draw::Calculation)
@ -2883,7 +2887,7 @@ bool MainWindow::Save()
bool result = SavePattern(qApp->GetPPath(), error);
if (result)
{
QFile::remove(qApp->GetPPath() + autosavePrefix);
QFile::remove(qApp->GetPPath() + *autosavePrefix);
m_curFileFormatVersion = VPatternConverter::PatternMaxVer;
m_curFileFormatVersionStr = VPatternConverter::PatternMaxVerStr;
}
@ -3011,7 +3015,7 @@ void MainWindow::FileClosedCorrect()
qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
// Remove autosave file
QFile autofile(qApp->GetPPath() + autosavePrefix);
QFile autofile(qApp->GetPPath() + *autosavePrefix);
if (autofile.exists())
{
autofile.remove();
@ -3596,7 +3600,7 @@ QT_WARNING_POP
ui->actionLast_tool->setEnabled(drawTools);
for (auto pointer : toolButtonPointerList)
for (auto pointer : qAsConst(toolButtonPointerList))
{
pointer->setEnabled(drawTools || modelingTools);
pointer->setChecked(drawTools || modelingTools);
@ -3683,7 +3687,7 @@ void MainWindow::AutoSavePattern()
if (qApp->GetPPath().isEmpty() == false && this->isWindowModified() == true)
{
QString autofile = qApp->GetPPath() + autosavePrefix;
QString autofile = qApp->GetPPath() + *autosavePrefix;
QString error;
SavePattern(autofile, error);
}
@ -3886,7 +3890,7 @@ void MainWindow::LastUsedTool()
switch ( lastUsedTool )
{
case Tool::Arrow:
for (auto pointer : toolButtonPointerList)
for (auto pointer : qAsConst(toolButtonPointerList))
{
pointer->setChecked(true);
}
@ -4299,7 +4303,7 @@ void MainWindow::CreateActions()
ui->actionShowCurveDetails->setChecked(qApp->ValentinaSettings()->IsShowCurveDetails());
connect(ui->actionShowCurveDetails, &QAction::triggered, this, [this](bool checked)
{
ui->view->itemClicked(nullptr);
emit ui->view->itemClicked(nullptr);
sceneDraw->EnableDetailsMode(checked);
qApp->ValentinaSettings()->SetShowCurveDetails(checked);
});
@ -4640,7 +4644,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
QStringList filtered;
for (int i = 0; i < files.size(); ++i)
{
if (QFileInfo(files.at(i)).exists())
if (QFileInfo::exists(files.at(i)))
{
filtered.append(files.at(i));
}
@ -4830,7 +4834,7 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args)
QStringList restoreFiles;
for (int i = 0; i < files.size(); ++i)
{
QFile file(files.at(i) + autosavePrefix);
QFile file(files.at(i) + *autosavePrefix);
if (file.exists())
{
restoreFiles.append(files.at(i));
@ -4851,9 +4855,9 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args)
for (int i = 0; i < restoreFiles.size(); ++i)
{
QString error;
if (VDomDocument::SafeCopy(restoreFiles.at(i) + autosavePrefix, restoreFiles.at(i), error))
if (VDomDocument::SafeCopy(restoreFiles.at(i) + *autosavePrefix, restoreFiles.at(i), error))
{
QFile autoFile(restoreFiles.at(i) + autosavePrefix);
QFile autoFile(restoreFiles.at(i) + *autosavePrefix);
autoFile.remove();
LoadPattern(restoreFiles.at(i));
args.removeAll(restoreFiles.at(i));// Do not open file twice after we restore him.
@ -4861,7 +4865,7 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args)
else
{
qCDebug(vMainWindow, "Could not copy %s%s to %s %s",
qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(autosavePrefix),
qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(*autosavePrefix),
qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(error));
}
}
@ -5574,7 +5578,7 @@ bool MainWindow::IgnoreLocking(int error, const QString &path)
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectPoint() const
void MainWindow::ToolSelectPoint()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5598,21 +5602,21 @@ void MainWindow::ToolSelectPoint() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectPointByRelease() const
void MainWindow::ToolSelectPointByRelease()
{
ToolSelectPoint();
emit ItemsSelection(SelectionType::ByMouseRelease);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectPointByPress() const
void MainWindow::ToolSelectPointByPress()
{
ToolSelectPoint();
emit ItemsSelection(SelectionType::ByMousePress);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectSpline() const
void MainWindow::ToolSelectSpline()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5638,7 +5642,7 @@ void MainWindow::ToolSelectSpline() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectSplinePath() const
void MainWindow::ToolSelectSplinePath()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5664,7 +5668,7 @@ void MainWindow::ToolSelectSplinePath() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectArc() const
void MainWindow::ToolSelectArc()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5690,7 +5694,7 @@ void MainWindow::ToolSelectArc() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectPointArc() const
void MainWindow::ToolSelectPointArc()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5716,7 +5720,7 @@ void MainWindow::ToolSelectPointArc() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectCurve() const
void MainWindow::ToolSelectCurve()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5742,7 +5746,7 @@ void MainWindow::ToolSelectCurve() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectAllDrawObjects() const
void MainWindow::ToolSelectAllDrawObjects()
{
// Only true for rubber band selection
emit EnableLabelSelection(false);
@ -5768,7 +5772,7 @@ void MainWindow::ToolSelectAllDrawObjects() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectOperationObjects() const
void MainWindow::ToolSelectOperationObjects()
{
// Only true for rubber band selection
emit EnableLabelSelection(true);
@ -5794,7 +5798,7 @@ void MainWindow::ToolSelectOperationObjects() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectGroupObjects() const
void MainWindow::ToolSelectGroupObjects()
{
ToolSelectOperationObjects();
// Only true for rubber band selection
@ -5805,7 +5809,7 @@ void MainWindow::ToolSelectGroupObjects() const
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSelectDetail() const
void MainWindow::ToolSelectDetail()
{
// Only true for rubber band selection
emit EnableNodeLabelSelection(false);

View File

@ -74,29 +74,29 @@ public slots:
signals:
void RefreshHistory();
void EnableItemMove(bool move);
void ItemsSelection(SelectionType type) const;
void ItemsSelection(SelectionType type);
void EnableLabelSelection(bool enable) const;
void EnablePointSelection(bool enable) const;
void EnableLineSelection(bool enable) const;
void EnableArcSelection(bool enable) const;
void EnableElArcSelection(bool enable) const;
void EnableSplineSelection(bool enable) const;
void EnableSplinePathSelection(bool enable) const;
void EnableNodeLabelSelection(bool enable) const;
void EnableNodePointSelection(bool enable) const;
void EnableDetailSelection(bool enable) const;
void EnableLabelSelection(bool enable);
void EnablePointSelection(bool enable);
void EnableLineSelection(bool enable);
void EnableArcSelection(bool enable);
void EnableElArcSelection(bool enable);
void EnableSplineSelection(bool enable);
void EnableSplinePathSelection(bool enable);
void EnableNodeLabelSelection(bool enable);
void EnableNodePointSelection(bool enable);
void EnableDetailSelection(bool enable);
void EnableLabelHover(bool enable) const;
void EnablePointHover(bool enable) const;
void EnableLineHover(bool enable) const;
void EnableArcHover(bool enable) const;
void EnableElArcHover(bool enable) const;
void EnableSplineHover(bool enable) const;
void EnableSplinePathHover(bool enable) const;
void EnableNodeLabelHover(bool enable) const;
void EnableNodePointHover(bool enable) const;
void EnableDetailHover(bool enable) const;
void EnableLabelHover(bool enable);
void EnablePointHover(bool enable);
void EnableLineHover(bool enable);
void EnableArcHover(bool enable);
void EnableElArcHover(bool enable);
void EnableSplineHover(bool enable);
void EnableSplinePathHover(bool enable);
void EnableNodeLabelHover(bool enable);
void EnableNodePointHover(bool enable);
void EnableDetailHover(bool enable);
protected:
virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
@ -377,18 +377,18 @@ private:
bool IgnoreLocking(int error, const QString &path);
void ToolSelectPoint() const;
void ToolSelectPointByPress() const;
void ToolSelectPointByRelease() const;
void ToolSelectSpline() const;
void ToolSelectSplinePath() const;
void ToolSelectArc() const;
void ToolSelectPointArc() const;
void ToolSelectCurve() const;
void ToolSelectAllDrawObjects() const;
void ToolSelectOperationObjects() const;
void ToolSelectGroupObjects() const;
void ToolSelectDetail() const;
void ToolSelectPoint();
void ToolSelectPointByPress();
void ToolSelectPointByRelease();
void ToolSelectSpline();
void ToolSelectSplinePath();
void ToolSelectArc();
void ToolSelectPointArc();
void ToolSelectCurve();
void ToolSelectAllDrawObjects();
void ToolSelectOperationObjects();
void ToolSelectGroupObjects();
void ToolSelectDetail();
};
#endif // MAINWINDOW_H

View File

@ -1082,7 +1082,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList &params) const
QFile f(params.last());
if (f.exists() == false)
{
const QString msg = tr("Creating file '%1' failed! %2").arg(params.last()).arg(proc.errorString());
const QString msg = tr("Creating file '%1' failed! %2").arg(params.last(), proc.errorString());
QMessageBox msgBox(QMessageBox::Critical, tr("Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default);
msgBox.exec();
}

View File

@ -43,6 +43,7 @@
#include <QtDebug>
#include <QSslConfiguration>
#include <QDir>
#include <QGlobalStatic>
#include "../ifc/exception/vexception.h"
#include "../ifc/xml/vabstractconverter.h"
@ -54,8 +55,10 @@
namespace
{
const QString defaultFeedURL = QStringLiteral("https://valentinaproject.bitbucket.io/Appcast.xml");
const QString testFeedURL = QStringLiteral("https://valentinaproject.bitbucket.io/Appcast_testing.xml");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL,
(QLatin1String("https://valentinaproject.bitbucket.io/Appcast.xml")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL,
(QLatin1String("https://valentinaproject.bitbucket.io/Appcast_testing.xml")))
}
QPointer<FvUpdater> FvUpdater::m_Instance;
@ -86,7 +89,7 @@ void FvUpdater::drop()
//---------------------------------------------------------------------------------------------------------------------
QString FvUpdater::CurrentFeedURL()
{
return FvUpdater::IsTestBuild() ? testFeedURL : defaultFeedURL;
return FvUpdater::IsTestBuild() ? *testFeedURL : *defaultFeedURL;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -134,12 +134,6 @@ Q_NORETURN void VException::raise() const
throw *this;
}
//---------------------------------------------------------------------------------------------------------------------
const char* VException::what() const V_NOEXCEPT_EXPR (true)
{
return error.toUtf8().constData();
}
//-----------------------------------------VExceptionToolWasDeleted----------------------------------------------------
VExceptionToolWasDeleted::VExceptionToolWasDeleted(const QString &error)
:VException(error)

View File

@ -58,7 +58,6 @@ public:
QString WhatUtf8() const V_NOEXCEPT_EXPR (true);
void AddMoreInformation(const QString &info);
QString MoreInformation() const;
virtual const char* what() const V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE;
protected:
/** @brief error string with error */

View File

@ -83,7 +83,7 @@ QString VExceptionBadId::ErrorMessage() const
}
else
{
error = QString("ExceptionBadId: %1, id = %2").arg(this->error).arg(key);
error = QString("ExceptionBadId: %1, id = %2").arg(this->error, key);
}
return error;
}

View File

@ -178,10 +178,7 @@ void VAbstractConverter::ReserveFile() const
QString error;
QFileInfo info(m_convertedFileName);
const QString reserveFileName = QString("%1/%2(v%3).%4.bak")
.arg(info.absoluteDir().absolutePath())
.arg(info.baseName())
.arg(GetVersionStr())
.arg(info.completeSuffix());
.arg(info.absoluteDir().absolutePath(), info.baseName(), GetVersionStr(), info.completeSuffix());
if (not SafeCopy(m_convertedFileName, reserveFileName, error))
{
#ifdef Q_OS_WIN32

View File

@ -633,7 +633,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
// cppcheck-suppress ConfigurationNotChecked
if (pattern.open(QIODevice::ReadOnly) == false)
{
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString()));
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, pattern.errorString()));
throw VException(errorMsg);
}
@ -642,7 +642,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
if (fileSchema.open(QIODevice::ReadOnly) == false)
{
pattern.close();
const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString()));
const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema, fileSchema.errorString()));
throw VException(errorMsg);
}
@ -693,7 +693,7 @@ void VDomDocument::setXMLContent(const QString &fileName)
// cppcheck-suppress ConfigurationNotChecked
if (file.open(QIODevice::ReadOnly) == false)
{
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(file.errorString()));
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, file.errorString()));
throw VException(errorMsg);
}

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <QGlobalStatic>
#include "../exception/vexception.h"
#include "../vmisc/def.h"
@ -59,13 +60,16 @@ const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/in
//VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
namespace
{
// The list of all string we use for conversion
// Better to use global variables because repeating QStringLiteral blows up code size
static const QString strTagRead_Only = QStringLiteral("read-only");
static const QString strGivenName = QStringLiteral("given-name");
static const QString strFamilyName = QStringLiteral("family-name");
static const QString strCustomer = QStringLiteral("customer");
static const QString strPersonal = QStringLiteral("personal");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGivenName, (QLatin1String("given-name")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFamilyName, (QLatin1String("family-name")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomer, (QLatin1String("customer")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPersonal, (QLatin1String("personal")))
}
//---------------------------------------------------------------------------------------------------------------------
VVITConverter::VVITConverter(const QString &fileName)
@ -149,7 +153,7 @@ bool VVITConverter::IsReadOnly() const
// For now position is the same for all supported format versions.
// But don't forget to keep all versions of attribute until we support that format versions
return UniqueTagText(strTagRead_Only, falseStr) == trueStr;
return UniqueTagText(*strTagRead_Only, falseStr) == trueStr;
}
//---------------------------------------------------------------------------------------------------------------------
@ -315,7 +319,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_3()
void VVITConverter::ConverCustomerNameToV0_4_0()
{
// Find root tag
const QDomNodeList personalList = this->elementsByTagName(strPersonal);
const QDomNodeList personalList = this->elementsByTagName(*strPersonal);
if (personalList.isEmpty())
{
return;
@ -325,7 +329,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0()
// Given name
QString givenName;
const QDomNodeList givenNameList = this->elementsByTagName(strGivenName);
const QDomNodeList givenNameList = this->elementsByTagName(*strGivenName);
if (not givenNameList.isEmpty())
{
QDomNode givenNameNode = givenNameList.at(0);
@ -335,7 +339,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0()
// Family name
QString familyName;
const QDomNodeList familyNameList = this->elementsByTagName(strFamilyName);
const QDomNodeList familyNameList = this->elementsByTagName(*strFamilyName);
if (not familyNameList.isEmpty())
{
QDomNode familyNameNode = familyNameList.at(0);
@ -343,7 +347,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0()
personal.removeChild(familyNameNode);
}
QDomElement customer = createElement(strCustomer);
QDomElement customer = createElement(*strCustomer);
QString customerName;
if (not givenName.isEmpty() && not familyName.isEmpty())

View File

@ -39,6 +39,7 @@
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <QGlobalStatic>
#include "../exception/vexception.h"
#include "../vmisc/def.h"
@ -59,7 +60,10 @@ const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/st
//VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
static const QString strTagRead_Only = QStringLiteral("read-only");
namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only")))
}
//---------------------------------------------------------------------------------------------------------------------
VVSTConverter::VVSTConverter(const QString &fileName)
@ -143,7 +147,7 @@ bool VVSTConverter::IsReadOnly() const
// For now position is the same for all supported format versions.
// But don't forget to keep all versions of attribute until we support that format versions
return UniqueTagText(strTagRead_Only, falseStr) == trueStr;
return UniqueTagText(*strTagRead_Only, falseStr) == trueStr;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -323,7 +323,7 @@ QString NameRegExp()
// \p{Zs} - \p{Space_Separator}
regex = QString("^([^\\p{Nd}\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;'\"]){1,1}"
"([^\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;\"]){0,}$")
.arg(negativeSigns).arg(positiveSigns).arg(decimalPoints).arg(groupSeparators);
.arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators);
}
return regex;

View File

@ -41,6 +41,7 @@
#include <QStringData>
#include <QStringDataPtr>
#include <QtDebug>
#include <QGlobalStatic>
#include "../ifc/exception/vexceptionemptyparameter.h"
#include "../ifc/xml/vvitconverter.h"
@ -82,10 +83,10 @@ const QString VMeasurements::GenderMale = QStringLiteral("male");
const QString VMeasurements::GenderFemale = QStringLiteral("female");
const QString VMeasurements::GenderUnknown = QStringLiteral("unknown");
const QString defBirthDate = QStringLiteral("1800-01-01");
namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01")))
//---------------------------------------------------------------------------------------------------------------------
QString FileComment()
{
@ -400,7 +401,7 @@ void VMeasurements::SetCustomer(const QString &text)
//---------------------------------------------------------------------------------------------------------------------
QDate VMeasurements::BirthDate() const
{
return QDate::fromString(UniqueTagText(TagBirthDate, defBirthDate), "yyyy-MM-dd");
return QDate::fromString(UniqueTagText(TagBirthDate, *defBirthDate), "yyyy-MM-dd");
}
//---------------------------------------------------------------------------------------------------------------------
@ -755,7 +756,7 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
personal.appendChild(createElement(TagCustomer));
QDomElement date = createElement(TagBirthDate);
date.appendChild(createTextNode(defBirthDate));
date.appendChild(createTextNode(*defBirthDate));
personal.appendChild(date);
QDomElement gender = createElement(TagGender);

View File

@ -136,7 +136,7 @@ QPointF VAbstractCubicBezier::CutSpline(qreal length, QPointF &spl1p2, QPointF &
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractCubicBezier::NameForHistory(const QString &toolName) const
{
QString name = toolName + QString(" %1_%2").arg(GetP1().name()).arg(GetP4().name());
QString name = toolName + QString(" %1_%2").arg(GetP1().name(), GetP4().name());
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
@ -173,7 +173,7 @@ qreal VAbstractCubicBezier::GetParmT(qreal length) const
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCubicBezier::CreateName()
{
QString name = SPL_ + QString("%1_%2").arg(GetP1().name()).arg(GetP4().name());
QString name = SPL_ + QString("%1_%2").arg(GetP1().name(), GetP4().name());
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());

View File

@ -277,7 +277,11 @@ QVector<QPointF> VEllipticalArc::GetPoints() const
const QList<QPolygonF> sub = path.toSubpathPolygons();
if (not sub.isEmpty())
{
polygon = path.toSubpathPolygons().first();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
polygon = path.toSubpathPolygons().constFirst();
#else
polygon = path.toSubpathPolygons().first(); // clazy:exclude=detaching-temporary
#endif
if (not polygon.isEmpty())
{
polygon.removeFirst(); // remove point (0;0)

View File

@ -328,7 +328,11 @@ qreal VSplinePath::GetStartAngle() const
{
if (CountPoints() > 0)
{
return GetSplinePath().first().Angle2();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return GetSplinePath().constFirst().Angle2();
#else
return GetSplinePath().first().Angle2(); // clazy:exclude=detaching-temporary
#endif
}
else
{
@ -341,7 +345,11 @@ qreal VSplinePath::GetEndAngle() const
{
if (CountPoints() > 0)
{
return GetSplinePath().last().Angle1();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return GetSplinePath().constLast().Angle1();
#else
return GetSplinePath().last().Angle1(); // clazy:exclude=detaching-temporary
#endif
}
else
{
@ -354,7 +362,11 @@ qreal VSplinePath::GetC1Length() const
{
if (CountPoints() > 0)
{
return GetSplinePath().first().Length2();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return GetSplinePath().constFirst().Length2();
#else
return GetSplinePath().first().Length2(); // clazy:exclude=detaching-temporary
#endif
}
else
{
@ -367,7 +379,11 @@ qreal VSplinePath::GetC2Length() const
{
if (CountPoints() > 0)
{
return GetSplinePath().last().Length1();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return GetSplinePath().constLast().Length1();
#else
return GetSplinePath().last().Length1(); // clazy:exclude=detaching-temporary
#endif
}
else
{
@ -380,7 +396,11 @@ VPointF VSplinePath::FirstPoint() const
{
if (not d->path.isEmpty())
{
return d->path.first().P();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return d->path.constFirst().P();
#else
return d->path.first().P(); // clazy:exclude=detaching-temporary
#endif
}
else
{

View File

@ -53,6 +53,7 @@
#include <QtDebug>
#include <QPixmapCache>
#include <QGraphicsItem>
#include <QGlobalStatic>
#include "vabstractapplication.h"
@ -621,8 +622,9 @@ void InitHighDpiScaling(int argc, char *argv[])
const QString strOne = QStringLiteral("one");
const QString strTwo = QStringLiteral("two");
const QString strThree = QStringLiteral("three");
const QString strTMark = QStringLiteral("tMark");
const QString strVMark = QStringLiteral("vMark");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, (QLatin1String("tMark")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark")))
//---------------------------------------------------------------------------------------------------------------------
QString PassmarkLineTypeToString(PassmarkLineType type)
@ -636,9 +638,9 @@ QString PassmarkLineTypeToString(PassmarkLineType type)
case PassmarkLineType::ThreeLines:
return strThree;
case PassmarkLineType::TMark:
return strTMark;
return *strTMark;
case PassmarkLineType::VMark:
return strVMark;
return *strVMark;
default:
break;
}
@ -649,7 +651,7 @@ QString PassmarkLineTypeToString(PassmarkLineType type)
//---------------------------------------------------------------------------------------------------------------------
PassmarkLineType StringToPassmarkLineType(const QString &value)
{
const QStringList values = QStringList() << strOne << strTwo << strThree << strTMark << strVMark;
const QStringList values = QStringList() << strOne << strTwo << strThree << *strTMark << *strVMark;
switch(values.indexOf(value))
{
@ -830,7 +832,7 @@ void InitLanguages(QComboBox *combobox)
QLocale loc = QLocale(locale);
QString lang = loc.nativeLanguageName();
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
QIcon ico(QString("%1/%2.png").arg("://flags", QLocale::countryToString(loc.country())));
combobox->addItem(ico, lang, locale);
}
@ -838,7 +840,7 @@ void InitLanguages(QComboBox *combobox)
if (combobox->count() == 0 || not englishUS)
{
// English language is internal and doens't have own *.qm file.
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
QIcon ico(QString("%1/%2.png").arg("://flags", QLocale::countryToString(QLocale::UnitedStates)));
QString lang = QLocale(en_US).nativeLanguageName();
combobox->addItem(ico, lang, en_US);
}

View File

@ -35,4 +35,13 @@
#define PRINTDPI 96.0
extern const qreal PrintDPI;
#if QT_VERSION <= QT_VERSION_CHECK(5, 7, 0)
// this adds const to non-const objects (like std::as_const)
template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
// prevent rvalue arguments:
template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif
#endif // DEFGLOBAL_H

View File

@ -399,7 +399,7 @@ bool QxtCsvModel::insertRows(int row, int count, const QModelIndex& parent)
{
return false;
}
emit beginInsertRows(parent, row, row + count);
beginInsertRows(parent, row, row + count);
QxtCsvModelPrivate& d_ptr = qxt_d();
if (row >= rowCount())
{
@ -415,7 +415,7 @@ bool QxtCsvModel::insertRows(int row, int count, const QModelIndex& parent)
d_ptr.csvData.insert(row, QStringList());
}
}
emit endInsertRows();
endInsertRows();
return true;
}
@ -444,13 +444,13 @@ bool QxtCsvModel::removeRows(int row, int count, const QModelIndex& parent)
{
count = rowCount() - row;
}
emit beginRemoveRows(parent, row, row + count);
beginRemoveRows(parent, row, row + count);
QxtCsvModelPrivate& d_ptr = qxt_d();
for (int i = 0;i < count;i++)
{
d_ptr.csvData.removeAt(row);
}
emit endRemoveRows();
endRemoveRows();
return true;
}
@ -519,7 +519,7 @@ bool QxtCsvModel::removeColumns(int col, int count, const QModelIndex& parent)
{
count = columnCount() - col;
}
emit beginRemoveColumns(parent, col, col + count);
beginRemoveColumns(parent, col, col + count);
QxtCsvModelPrivate& d_ptr = qxt_d();
for (int i = 0; i < rowCount(); i++)
{
@ -532,7 +532,7 @@ bool QxtCsvModel::removeColumns(int col, int count, const QModelIndex& parent)
{
d_ptr.header.removeAt(col);
}
emit endRemoveColumns();
endRemoveColumns();
return true;
}

View File

@ -40,6 +40,7 @@
#include <QtDebug>
#include <QTextCodec>
#include <QFont>
#include <QGlobalStatic>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
@ -47,58 +48,58 @@
namespace
{
const QString settingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString settingPathsMultisizeMeasurements = QStringLiteral("paths/standard_measurements");
const QString settingPathsTemplates = QStringLiteral("paths/templates");
const QString settingPathsLabelTemplate = QStringLiteral("paths/labels");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, (QLatin1String("paths/individual_measurements")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, (QLatin1String("paths/standard_measurements")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, (QLatin1String("paths/templates")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels")))
const QString settingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
const QString settingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
const QString settingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString settingConfigurationLocale = QStringLiteral("configuration/locale");
const QString settingPMSystemCode = QStringLiteral("configuration/pmscode");
const QString settingConfigurationUnit = QStringLiteral("configuration/unit");
const QString settingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion");
const QString settingConfigurationConfirmFormatRewriting = QStringLiteral("configuration/confirm_format_rewriting");
const QString settingConfigurationToolBarStyle = QStringLiteral("configuration/tool_bar_style");
const QString settingConfigurationFreeCurveMode = QStringLiteral("configuration/freeCurveMode");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, (QLatin1String("configuration/osSeparator")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState, (QLatin1String("configuration/autosave/state")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime , (QLatin1String("configuration/autosave/time")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, (QLatin1String("configuration/locale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, (QLatin1String("configuration/pmscode")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, (QLatin1String("configuration/unit")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion, (QLatin1String("configuration/confirm_item_deletion")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting, (QLatin1String("configuration/confirm_format_rewriting")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode")))
const QString settingPatternUndo = QStringLiteral("pattern/undo");
const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
const QString settingPatternForceFlipping = QStringLiteral("pattern/forceFlipping");
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance");
const QString settingPatternLabelFont = QStringLiteral("pattern/labelFont");
const QString settingPatternLineWidth = QStringLiteral("pattern/lineWidth");
const QString settingPatternCurveApproximationScale = QStringLiteral("pattern/curveApproximationScale");
const QString settingPatternShowCurveDetails = QStringLiteral("pattern/showCurveDetails");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, (QLatin1String("pattern/forceFlipping")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, (QLatin1String("pattern/hideMainPath")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, (QLatin1String("pattern/doublePassmark")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance, (QLatin1String("pattern/defaultSeamAllowance")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, (QLatin1String("pattern/labelFont")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, (QLatin1String("pattern/lineWidth")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale, (QLatin1String("pattern/curveApproximationScale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin1String("pattern/showCurveDetails")))
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString settingGeneralGeometry = QStringLiteral("geometry");
const QString settingGeneralWindowState = QStringLiteral("windowState");
const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString settingToolSeamAllowanceDialogSize = QStringLiteral("toolSeamAllowanceDialogSize");
const QString settingIncrementsDialogSize = QStringLiteral("toolIncrementsDialogSize");
const QString settingFormulaWizardDialogSize = QStringLiteral("formulaWizardDialogSize");
const QString settingFinalMeasurementsDialogSize = QStringLiteral("finalMeasurementsDialogSize");
const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, (QLatin1String("geometry")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralWindowState, (QLatin1String("windowState")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, (QLatin1String("toolbarsState")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, (QLatin1String("toolSeamAllowanceDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind")))
const QString settingCSVWithHeader = QStringLiteral("csv/withHeader");
const QString settingCSVCodec = QStringLiteral("csv/withCodec");
const QString settingCSVSeparator = QStringLiteral("csv/withSeparator");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, (QLatin1String("csv/withHeader")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVCodec, (QLatin1String("csv/withCodec")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVSeparator, (QLatin1String("csv/withSeparator")))
const QString settingLabelDateFormat = QStringLiteral("label/dateFormat");
const QString settingLabelUserDateFormats = QStringLiteral("label/userDateFormats");
const QString settingLabelTimeFormat = QStringLiteral("label/timeFormat");
const QString settingLabelUserTimeFormats = QStringLiteral("label/userTimeFormats");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, (QLatin1String("label/dateFormat")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, (QLatin1String("label/userDateFormats")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, (QLatin1String("label/timeFormat")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, (QLatin1String("label/userTimeFormats")))
// Reading settings file is very expensive, cache curve approximation to speed up getting value
qreal curveApproximationCached = -1;
QString localeCached = QString();
Q_GLOBAL_STATIC(QString, localeCached)
qreal lineWidthCached = 0;
//---------------------------------------------------------------------------------------------------------------------
@ -112,7 +113,7 @@ QStringList ClearFormats(const QStringList &predefinedFormats, QStringList forma
}
}
static const QString commonIniFilename = QStringLiteral("common");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, commonIniFilename, (QLatin1String("common")))
#if !defined(Q_OS_WIN)
const QString VCommonSettings::unixStandardSharePath = QStringLiteral("/usr/share/valentina");
@ -126,7 +127,8 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool
QDir dir;
dir.setPath(fromDir);
foreach (QString copyFile, dir.entryList(QDir::Files))
const QStringList list = dir.entryList(QDir::Files);
for (const QString &copyFile : list)
{
const QString from = fromDir + QDir::separator() + copyFile;
QString to = toDir + QDir::separator() + copyFile;
@ -188,7 +190,8 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool
QFile::link(from, to);
}
foreach (QString copyDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
const QStringList dirList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (const QString &copyDir : dirList)
{
const QString from = fromDir + QDir::separator() + copyDir;
const QString to = toDir + QDir::separator() + copyDir;
@ -315,15 +318,15 @@ QString VCommonSettings::GetDefPathIndividualMeasurements()
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetPathIndividualMeasurements() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathIndividualMeasurements(const QString &value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingPathsIndividualMeasurements, value);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingPathsIndividualMeasurements, value);
settings.sync();
}
@ -336,15 +339,15 @@ QString VCommonSettings::GetDefPathMultisizeMeasurements()
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetPathMultisizeMeasurements() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingPathsMultisizeMeasurements, GetDefPathMultisizeMeasurements()).toString();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingPathsMultisizeMeasurements, GetDefPathMultisizeMeasurements()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathMultisizeMeasurements(const QString &value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingPathsMultisizeMeasurements, value);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingPathsMultisizeMeasurements, value);
settings.sync();
}
@ -357,15 +360,15 @@ QString VCommonSettings::GetDefPathTemplate()
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetPathTemplate() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingPathsTemplates, GetDefPathTemplate()).toString();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingPathsTemplates, GetDefPathTemplate()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathTemplate(const QString &value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingPathsTemplates, value);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingPathsTemplates, value);
settings.sync();
}
@ -378,47 +381,47 @@ QString VCommonSettings::GetDefPathLabelTemplate()
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetPathLabelTemplate() const
{
return value(settingPathsLabelTemplate, GetDefPathLabelTemplate()).toString();
return value(*settingPathsLabelTemplate, GetDefPathLabelTemplate()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPathLabelTemplate(const QString &value)
{
setValue(settingPathsLabelTemplate, value);
setValue(*settingPathsLabelTemplate, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetOsSeparator() const
{
return value(settingConfigurationOsSeparator, 1).toBool();
return value(*settingConfigurationOsSeparator, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetOsSeparator(const bool &value)
{
setValue(settingConfigurationOsSeparator, value);
setValue(*settingConfigurationOsSeparator, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetAutosaveState() const
{
return value(settingConfigurationAutosaveState, 1).toBool();
return value(*settingConfigurationAutosaveState, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetAutosaveState(const bool &value)
{
setValue(settingConfigurationAutosaveState, value);
setValue(*settingConfigurationAutosaveState, value);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetAutosaveTime() const
{
bool ok = false;
int val = value(settingConfigurationAutosaveTime, 1).toInt(&ok);
int val = value(*settingConfigurationAutosaveTime, 1).toInt(&ok);
if (ok == false)
{
qDebug()<<"Could not convert value"<<value(settingConfigurationAutosaveTime, 1)
qDebug()<<"Could not convert value"<<value(*settingConfigurationAutosaveTime, 1)
<<"to int. Return default value for autosave time"<<1<<"minutes.";
val = 1;
}
@ -428,107 +431,107 @@ int VCommonSettings::GetAutosaveTime() const
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetAutosaveTime(const int &value)
{
setValue(settingConfigurationAutosaveTime, value);
setValue(*settingConfigurationAutosaveTime, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetLocale() const
{
if (localeCached.isEmpty())
if (localeCached->isEmpty())
{
localeCached = value(settingConfigurationLocale, QLocale().name()).toString();
*localeCached = value(*settingConfigurationLocale, QLocale().name()).toString();
}
return localeCached;
return *localeCached;
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLocale(const QString &value)
{
setValue(settingConfigurationLocale, value);
localeCached = value;
setValue(*settingConfigurationLocale, value);
*localeCached = value;
}
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetPMSystemCode() const
{
return value(settingPMSystemCode, "p998").toString();
return value(*settingPMSystemCode, "p998").toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPMSystemCode(const QString &value)
{
setValue(settingPMSystemCode, value);
setValue(*settingPMSystemCode, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetUnit() const
{
return value(settingConfigurationUnit,
return value(*settingConfigurationUnit,
QLocale().measurementSystem() == QLocale::MetricSystem ? unitCM : unitINCH).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUnit(const QString &value)
{
setValue(settingConfigurationUnit, value);
setValue(*settingConfigurationUnit, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetConfirmItemDelete() const
{
return value(settingConfigurationConfirmItemDeletion, 1).toBool();
return value(*settingConfigurationConfirmItemDeletion, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetConfirmItemDelete(const bool &value)
{
setValue(settingConfigurationConfirmItemDeletion, value);
setValue(*settingConfigurationConfirmItemDeletion, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetConfirmFormatRewriting() const
{
return value(settingConfigurationConfirmFormatRewriting, 1).toBool();
return value(*settingConfigurationConfirmFormatRewriting, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetConfirmFormatRewriting(const bool &value)
{
setValue(settingConfigurationConfirmFormatRewriting, value);
setValue(*settingConfigurationConfirmFormatRewriting, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetToolBarStyle() const
{
return value(settingConfigurationToolBarStyle, 1).toBool();
return value(*settingConfigurationToolBarStyle, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetToolBarStyle(const bool &value)
{
setValue(settingConfigurationToolBarStyle, value);
setValue(*settingConfigurationToolBarStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsFreeCurveMode() const
{
return value(settingConfigurationFreeCurveMode, 1).toBool();
return value(*settingConfigurationFreeCurveMode, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetFreeCurveMode(bool value)
{
setValue(settingConfigurationFreeCurveMode, value);
setValue(*settingConfigurationFreeCurveMode, value);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetUndoCount() const
{
bool ok = false;
int val = value(settingPatternUndo, 0).toInt(&ok);
int val = value(*settingPatternUndo, 0).toInt(&ok);
if (ok == false)
{
qDebug()<<"Could not convert value"<<value(settingPatternUndo, 0)
qDebug()<<"Could not convert value"<<value(*settingPatternUndo, 0)
<<"to int. Return default value for undo counts 0 (no limit).";
val = 0;
}
@ -538,18 +541,18 @@ int VCommonSettings::GetUndoCount() const
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUndoCount(const int &value)
{
setValue(settingPatternUndo, value);
setValue(*settingPatternUndo, value);
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetRecentFileList() const
{
const QStringList files = value(settingGeneralRecentFileList).toStringList();
const QStringList files = value(*settingGeneralRecentFileList).toStringList();
QStringList cleared;
for (int i = 0; i < files.size(); ++i)
{
if (QFileInfo(files.at(i)).exists())
if (QFileInfo::exists(files.at(i)))
{
cleared.append(files.at(i));
}
@ -561,157 +564,157 @@ QStringList VCommonSettings::GetRecentFileList() const
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetRecentFileList(const QStringList &value)
{
setValue(settingGeneralRecentFileList, value);
setValue(*settingGeneralRecentFileList, value);
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetRestoreFileList() const
{
return value(settingGeneralRestoreFileList).toStringList();
return value(*settingGeneralRestoreFileList).toStringList();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetRestoreFileList(const QStringList &value)
{
setValue(settingGeneralRestoreFileList, value);
setValue(*settingGeneralRestoreFileList, value);
}
//---------------------------------------------------------------------------------------------------------------------
QByteArray VCommonSettings::GetGeometry() const
{
return value(settingGeneralGeometry).toByteArray();
return value(*settingGeneralGeometry).toByteArray();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetGeometry(const QByteArray &value)
{
setValue(settingGeneralGeometry, value);
setValue(*settingGeneralGeometry, value);
}
//---------------------------------------------------------------------------------------------------------------------
QByteArray VCommonSettings::GetWindowState() const
{
return value(settingGeneralWindowState).toByteArray();
return value(*settingGeneralWindowState).toByteArray();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetWindowState(const QByteArray &value)
{
setValue(settingGeneralWindowState, value);
setValue(*settingGeneralWindowState, value);
}
//---------------------------------------------------------------------------------------------------------------------
QByteArray VCommonSettings::GetToolbarsState() const
{
return value(settingGeneralToolbarsState).toByteArray();
return value(*settingGeneralToolbarsState).toByteArray();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetToolbarsState(const QByteArray &value)
{
setValue(settingGeneralToolbarsState, value);
setValue(*settingGeneralToolbarsState, value);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetPreferenceDialogSize() const
{
return value(settingPreferenceDialogSize, QSize(0, 0)).toSize();
return value(*settingPreferenceDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPreferenceDialogSize(const QSize& sz)
{
setValue(settingPreferenceDialogSize, sz);
setValue(*settingPreferenceDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetToolSeamAllowanceDialogSize() const
{
return value(settingToolSeamAllowanceDialogSize, QSize(0, 0)).toSize();
return value(*settingToolSeamAllowanceDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetToolSeamAllowanceDialogSize(const QSize &sz)
{
setValue(settingToolSeamAllowanceDialogSize, sz);
setValue(*settingToolSeamAllowanceDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetFormulaWizardDialogSize() const
{
return value(settingFormulaWizardDialogSize, QSize(0, 0)).toSize();
return value(*settingFormulaWizardDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetFormulaWizardDialogSize(const QSize &sz)
{
setValue(settingFormulaWizardDialogSize, sz);
setValue(*settingFormulaWizardDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetIncrementsDialogSize() const
{
return value(settingIncrementsDialogSize, QSize(0, 0)).toSize();
return value(*settingIncrementsDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetIncrementsDialogSize(const QSize &sz)
{
setValue(settingIncrementsDialogSize, sz);
setValue(*settingIncrementsDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetFinalMeasurementsDialogSize() const
{
return value(settingFinalMeasurementsDialogSize, QSize(0, 0)).toSize();
return value(*settingFinalMeasurementsDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetFinalMeasurementsDialogSize(const QSize &sz)
{
setValue(settingFinalMeasurementsDialogSize, sz);
setValue(*settingFinalMeasurementsDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetLatestSkippedVersion() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingLatestSkippedVersion, 0x0).toInt();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingLatestSkippedVersion, 0x0).toInt();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLatestSkippedVersion(int value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingLatestSkippedVersion, value);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingLatestSkippedVersion, value);
settings.sync();
}
//---------------------------------------------------------------------------------------------------------------------
QDate VCommonSettings::GetDateOfLastRemind() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingDateOfLastRemind, QDate(1900, 1, 1)).toDate();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingDateOfLastRemind, QDate(1900, 1, 1)).toDate();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDateOfLastRemind(const QDate &date)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingDateOfLastRemind, date);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingDateOfLastRemind, date);
settings.sync();
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetForbidWorkpieceFlipping() const
{
return value(settingPatternForbidFlipping, false).toBool();
return value(*settingPatternForbidFlipping, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetForbidWorkpieceFlipping(bool value)
{
setValue(settingPatternForbidFlipping, value);
setValue(*settingPatternForbidFlipping, value);
if (value)
{
@ -722,13 +725,13 @@ void VCommonSettings::SetForbidWorkpieceFlipping(bool value)
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetForceWorkpieceFlipping() const
{
return value(settingPatternForceFlipping, false).toBool();
return value(*settingPatternForceFlipping, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetForceWorkpieceFlipping(bool value)
{
setValue(settingPatternForceFlipping, value);
setValue(*settingPatternForceFlipping, value);
if (value)
{
@ -739,39 +742,39 @@ void VCommonSettings::SetForceWorkpieceFlipping(bool value)
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsHideMainPath() const
{
return value(settingPatternHideMainPath, false).toBool();
return value(*settingPatternHideMainPath, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetHideMainPath(bool value)
{
setValue(settingPatternHideMainPath, value);
setValue(*settingPatternHideMainPath, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsDoublePassmark() const
{
return value(settingDoublePassmark, false).toBool();
return value(*settingDoublePassmark, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDoublePassmark(bool value)
{
setValue(settingDoublePassmark, value);
setValue(*settingDoublePassmark, value);
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetCSVWithHeader(bool withHeader)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingCSVWithHeader, withHeader);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingCSVWithHeader, withHeader);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetCSVWithHeader() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingCSVWithHeader, GetDefCSVWithHeader()).toBool();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingCSVWithHeader, GetDefCSVWithHeader()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -783,15 +786,15 @@ bool VCommonSettings::GetDefCSVWithHeader()
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetCSVCodec(int mib)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
settings.setValue(settingCSVCodec, mib);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingCSVCodec, mib);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetCSVCodec() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
return settings.value(settingCSVCodec, GetDefCSVCodec()).toInt();
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingCSVCodec, GetDefCSVCodec()).toInt();
}
//---------------------------------------------------------------------------------------------------------------------
@ -803,20 +806,20 @@ int VCommonSettings::GetDefCSVCodec()
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetCSVSeparator(const QChar &separator)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
switch(separator.toLatin1())
{
case '\t':
settings.setValue(settingCSVSeparator, 0);
settings.setValue(*settingCSVSeparator, 0);
break;
case ';':
settings.setValue(settingCSVSeparator, 1);
settings.setValue(*settingCSVSeparator, 1);
break;
case ' ':
settings.setValue(settingCSVSeparator, 2);
settings.setValue(*settingCSVSeparator, 2);
break;
default:
settings.setValue(settingCSVSeparator, 3);
settings.setValue(*settingCSVSeparator, 3);
break;
}
}
@ -824,8 +827,8 @@ void VCommonSettings::SetCSVSeparator(const QChar &separator)
//---------------------------------------------------------------------------------------------------------------------
QChar VCommonSettings::GetCSVSeparator() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
const quint8 separator = static_cast<quint8>(settings.value(settingCSVSeparator, 3).toUInt());
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
const quint8 separator = static_cast<quint8>(settings.value(*settingCSVSeparator, 3).toUInt());
switch(separator)
{
case 0:
@ -848,7 +851,7 @@ QChar VCommonSettings::GetDefCSVSeparator()
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDefaultSeamAllowance(double value)
{
setValue(settingPatternDefaultSeamAllowance, UnitConvertor(value, StrToUnits(GetUnit()), Unit::Cm));
setValue(*settingPatternDefaultSeamAllowance, UnitConvertor(value, StrToUnits(GetUnit()), Unit::Cm));
}
//---------------------------------------------------------------------------------------------------------------------
@ -877,10 +880,10 @@ double VCommonSettings::GetDefaultSeamAllowance()
}
bool ok = false;
double val = value(settingPatternDefaultSeamAllowance, -1).toDouble(&ok);
double val = value(*settingPatternDefaultSeamAllowance, -1).toDouble(&ok);
if (ok == false)
{
qDebug()<< "Could not convert value"<<value(settingPatternDefaultSeamAllowance, 0)
qDebug()<< "Could not convert value"<<value(*settingPatternDefaultSeamAllowance, 0)
<< "to real. Return default value for default seam allowance is "
<< defaultValue << ".";
val = defaultValue;
@ -901,19 +904,24 @@ double VCommonSettings::GetDefaultSeamAllowance()
//---------------------------------------------------------------------------------------------------------------------
QFont VCommonSettings::GetLabelFont() const
{
return qvariant_cast<QFont>(value(settingPatternLabelFont, QApplication::font()));
return qvariant_cast<QFont>(value(*settingPatternLabelFont, QApplication::font()));
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLabelFont(const QFont &f)
{
setValue(settingPatternLabelFont, f);
setValue(*settingPatternLabelFont, f);
}
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetLabelDateFormat() const
{
const QString format = value(settingLabelDateFormat, VCommonSettings::PredefinedDateFormats().first()).toString();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
const QString format = value(*settingLabelDateFormat,
VCommonSettings::PredefinedDateFormats().constFirst()).toString();
#else
const QString format = value(*settingLabelDateFormat, VCommonSettings::PredefinedDateFormats().first()).toString(); // clazy:exclude=detaching-temporary
#endif
const QStringList allFormats = VCommonSettings::PredefinedDateFormats() + GetUserDefinedDateFormats();
if (allFormats.contains(format))
@ -922,14 +930,18 @@ QString VCommonSettings::GetLabelDateFormat() const
}
else
{
return VCommonSettings::PredefinedDateFormats().first();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return VCommonSettings::PredefinedDateFormats().constFirst();
#else
return VCommonSettings::PredefinedDateFormats().first(); // clazy:exclude=detaching-temporary
#endif
}
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLabelDateFormat(const QString &format)
{
setValue(settingLabelDateFormat, format);
setValue(*settingLabelDateFormat, format);
}
//---------------------------------------------------------------------------------------------------------------------
@ -961,19 +973,24 @@ QStringList VCommonSettings::PredefinedDateFormats()
//---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetUserDefinedDateFormats() const
{
return value(settingLabelUserDateFormats, QStringList()).toStringList();
return value(*settingLabelUserDateFormats, QStringList()).toStringList();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUserDefinedDateFormats(const QStringList &formats)
{
setValue(settingLabelUserDateFormats, ClearFormats(VCommonSettings::PredefinedDateFormats(), formats));
setValue(*settingLabelUserDateFormats, ClearFormats(VCommonSettings::PredefinedDateFormats(), formats));
}
//---------------------------------------------------------------------------------------------------------------------
QString VCommonSettings::GetLabelTimeFormat() const
{
const QString format = value(settingLabelTimeFormat, VCommonSettings::PredefinedTimeFormats().first()).toString();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
const QString format = value(*settingLabelTimeFormat,
VCommonSettings::PredefinedTimeFormats().constFirst()).toString();
#else
const QString format = value(*settingLabelTimeFormat, VCommonSettings::PredefinedTimeFormats().first()).toString(); // clazy:exclude=detaching-temporary
#endif
const QStringList allFormats = VCommonSettings::PredefinedTimeFormats() + GetUserDefinedTimeFormats();
if (allFormats.contains(format))
@ -982,14 +999,18 @@ QString VCommonSettings::GetLabelTimeFormat() const
}
else
{
return VCommonSettings::PredefinedTimeFormats().first();
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return VCommonSettings::PredefinedTimeFormats().constFirst();
#else
return VCommonSettings::PredefinedTimeFormats().first(); // clazy:exclude=detaching-temporary
#endif
}
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLabelTimeFormat(const QString &format)
{
setValue(settingLabelTimeFormat, format);
setValue(*settingLabelTimeFormat, format);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1005,13 +1026,13 @@ QStringList VCommonSettings::PredefinedTimeFormats()
//---------------------------------------------------------------------------------------------------------------------
QStringList VCommonSettings::GetUserDefinedTimeFormats() const
{
return value(settingLabelUserTimeFormats, QStringList()).toStringList();
return value(*settingLabelUserTimeFormats, QStringList()).toStringList();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetUserDefinedTimeFormats(const QStringList &formats)
{
setValue(settingLabelUserTimeFormats, ClearFormats(VCommonSettings::PredefinedTimeFormats(), formats));
setValue(*settingLabelUserTimeFormats, ClearFormats(VCommonSettings::PredefinedTimeFormats(), formats));
}
//---------------------------------------------------------------------------------------------------------------------
@ -1020,7 +1041,7 @@ qreal VCommonSettings::GetCurveApproximationScale() const
if (curveApproximationCached < 0)
{
bool ok = false;
const qreal scale = value(settingPatternCurveApproximationScale, defCurveApproximationScale).toDouble(&ok);
const qreal scale = value(*settingPatternCurveApproximationScale, defCurveApproximationScale).toDouble(&ok);
if (ok && scale >= minCurveApproximationScale && scale <= maxCurveApproximationScale)
{
curveApproximationCached = scale;
@ -1039,7 +1060,7 @@ void VCommonSettings::SetCurveApproximationScale(qreal value)
{
if (value >= minCurveApproximationScale && value <= maxCurveApproximationScale)
{
setValue(settingPatternCurveApproximationScale, value);
setValue(*settingPatternCurveApproximationScale, value);
curveApproximationCached = value;
}
}
@ -1047,13 +1068,13 @@ void VCommonSettings::SetCurveApproximationScale(qreal value)
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsShowCurveDetails() const
{
return value(settingPatternShowCurveDetails, false).toBool();
return value(*settingPatternShowCurveDetails, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetShowCurveDetails(bool value)
{
setValue(settingPatternShowCurveDetails, value);
setValue(*settingPatternShowCurveDetails, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1061,7 +1082,7 @@ qreal VCommonSettings::GetLineWidth() const
{
if (lineWidthCached <= 0)
{
lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), value(settingPatternLineWidth, 1.2).toDouble(),
lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), value(*settingPatternLineWidth, 1.2).toDouble(),
VCommonSettings::MaximalLineWidth());
}
@ -1072,7 +1093,7 @@ qreal VCommonSettings::GetLineWidth() const
void VCommonSettings::SetLineWidth(qreal width)
{
lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), width, VCommonSettings::MaximalLineWidth());
setValue(settingPatternLineWidth, lineWidthCached);
setValue(*settingPatternLineWidth, lineWidthCached);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -39,6 +39,7 @@
#include <QVariant>
#include <QPrinterInfo>
#include <QtDebug>
#include <QGlobalStatic>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
@ -47,36 +48,37 @@ Q_DECLARE_METATYPE(QMarginsF)
namespace
{
const QString settingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
(QLatin1String("configuration/label_language")))
const QString settingPathsPattern = QStringLiteral("paths/pattern");
const QString settingPathsLayout = QStringLiteral("paths/layout");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout")))
const QString settingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
const QString settingPatternUseOpenGLRender = QStringLiteral("pattern/useOpenGLRender");
const QString settingPatternKnownMaterials = QStringLiteral("pattern/knownMaterials");
const QString settingPatternRememberMaterials = QStringLiteral("pattern/rememberMaterials");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
const QString settingLayoutWidth = QStringLiteral("layout/width");
const QString settingLayoutSorting = QStringLiteral("layout/sorting");
const QString settingLayoutPaperHeight = QStringLiteral("layout/paperHeight");
const QString settingLayoutPaperWidth = QStringLiteral("layout/paperWidth");
const QString settingLayoutShift = QStringLiteral("layout/shift");
const QString settingLayoutRotate = QStringLiteral("layout/Rotate");
const QString settingLayoutRotationIncrease = QStringLiteral("layout/rotationIncrease");
const QString settingLayoutAutoCrop = QStringLiteral("layout/autoCrop");
const QString settingLayoutSaveLength = QStringLiteral("layout/saveLength");
const QString settingLayoutUnitePages = QStringLiteral("layout/unitePages");
const QString settingFields = QStringLiteral("layout/fields");
const QString settingIgnoreFields = QStringLiteral("layout/ignoreFields");
const QString settingStripOptimization = QStringLiteral("layout/stripOptimization");
const QString settingMultiplier = QStringLiteral("layout/multiplier");
const QString settingTextAsPaths = QStringLiteral("layout/textAsPaths");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShift, (QLatin1String("layout/shift")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutRotate, (QLatin1String("layout/Rotate")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutRotationIncrease, (QLatin1String("layout/rotationIncrease")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCrop, (QLatin1String("layout/autoCrop")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, (QLatin1String("layout/multiplier")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, (QLatin1String("layout/textAsPaths")))
const QString settingTiledPDFMargins = QStringLiteral("tiledPDF/margins");
const QString settingTiledPDFPaperHeight = QStringLiteral("tiledPDF/paperHeight");
const QString settingTiledPDFPaperWidth = QStringLiteral("tiledPDF/paperWidth");
const QString settingTiledPDFOrientation = QStringLiteral("tiledPDF/orientation");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String("tiledPDF/margins")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation")))
}
//---------------------------------------------------------------------------------------------------------------------
@ -90,13 +92,13 @@ VSettings::VSettings(Format format, Scope scope, const QString &organization, co
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetLabelLanguage() const
{
return value(settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
return value(*settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLabelLanguage(const QString &value)
{
setValue(settingConfigurationLabelLanguage, value);
setValue(*settingConfigurationLabelLanguage, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -109,14 +111,14 @@ QString VSettings::GetDefPathPattern()
QString VSettings::GetPathPattern() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
return settings.value(settingPathsPattern, GetDefPathPattern()).toString();
return settings.value(*settingPathsPattern, GetDefPathPattern()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetPathPattern(const QString &value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
settings.setValue(settingPathsPattern, value);
settings.setValue(*settingPathsPattern, value);
settings.sync();
}
@ -130,39 +132,39 @@ QString VSettings::GetDefPathLayout()
QString VSettings::GetPathLayout() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
return settings.value(settingPathsLayout, GetDefPathLayout()).toString();
return settings.value(*settingPathsLayout, GetDefPathLayout()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetPathLayout(const QString &value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
settings.setValue(settingPathsLayout, value);
settings.setValue(*settingPathsLayout, value);
settings.sync();
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetGraphicalOutput() const
{
return value(settingPatternGraphicalOutput, 1).toBool();
return value(*settingPatternGraphicalOutput, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetGraphicalOutput(const bool &value)
{
setValue(settingPatternGraphicalOutput, value);
setValue(*settingPatternGraphicalOutput, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::IsOpenGLRender() const
{
return value(settingPatternUseOpenGLRender, 0).toBool();
return value(*settingPatternUseOpenGLRender, 0).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetOpenGLRender(bool value)
{
setValue(settingPatternUseOpenGLRender, value);
setValue(*settingPatternUseOpenGLRender, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -170,7 +172,7 @@ qreal VSettings::GetLayoutPaperHeight() const
{
const qreal def = UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px);
bool ok = false;
const qreal height = value(settingLayoutPaperHeight, def).toDouble(&ok);
const qreal height = value(*settingLayoutPaperHeight, def).toDouble(&ok);
if (ok)
{
return height;
@ -184,7 +186,7 @@ qreal VSettings::GetLayoutPaperHeight() const
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutPaperHeight(qreal value)
{
setValue(settingLayoutPaperHeight, value);
setValue(*settingLayoutPaperHeight, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -192,7 +194,7 @@ qreal VSettings::GetLayoutPaperWidth() const
{
const qreal def = UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px);
bool ok = false;
const qreal width = value(settingLayoutPaperWidth, def).toDouble(&ok);
const qreal width = value(*settingLayoutPaperWidth, def).toDouble(&ok);
if (ok)
{
return width;
@ -206,7 +208,7 @@ qreal VSettings::GetLayoutPaperWidth() const
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutPaperWidth(qreal value)
{
setValue(settingLayoutPaperWidth, value);
setValue(*settingLayoutPaperWidth, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -214,7 +216,7 @@ qreal VSettings::GetLayoutShift() const
{
const qreal def = GetDefLayoutShift();
bool ok = false;
const qreal shift = value(settingLayoutShift, def).toDouble(&ok);
const qreal shift = value(*settingLayoutShift, def).toDouble(&ok);
if (ok)
{
return shift;
@ -234,7 +236,7 @@ qreal VSettings::GetDefLayoutShift()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutShift(qreal value)
{
setValue(settingLayoutShift, value);
setValue(*settingLayoutShift, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -242,7 +244,7 @@ qreal VSettings::GetLayoutWidth() const
{
const qreal def = GetDefLayoutWidth();
bool ok = false;
const qreal lWidth = value(settingLayoutWidth, def).toDouble(&ok);
const qreal lWidth = value(*settingLayoutWidth, def).toDouble(&ok);
if (ok)
{
return lWidth;
@ -262,13 +264,13 @@ qreal VSettings::GetDefLayoutWidth()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutWidth(qreal value)
{
setValue(settingLayoutWidth, value);
setValue(*settingLayoutWidth, value);
}
//---------------------------------------------------------------------------------------------------------------------
QMarginsF VSettings::GetFields(const QMarginsF &def) const
{
const QVariant val = value(settingFields, QVariant::fromValue(def));
const QVariant val = value(*settingFields, QVariant::fromValue(def));
if (val.canConvert<QMarginsF>())
{
return val.value<QMarginsF>();
@ -279,7 +281,7 @@ QMarginsF VSettings::GetFields(const QMarginsF &def) const
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetFields(const QMarginsF &value)
{
setValue(settingFields, QVariant::fromValue(value));
setValue(*settingFields, QVariant::fromValue(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -287,7 +289,7 @@ Cases VSettings::GetLayoutGroup() const
{
const Cases def = GetDefLayoutGroup();
bool ok = false;
const int g = value(settingLayoutSorting, static_cast<int>(def)).toInt(&ok);
const int g = value(*settingLayoutSorting, static_cast<int>(def)).toInt(&ok);
if (ok)
{
if (g >= static_cast<int>(Cases::UnknownCase))
@ -314,13 +316,13 @@ Cases VSettings::GetDefLayoutGroup()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutGroup(const Cases &value)
{
setValue(settingLayoutSorting, static_cast<int>(value));
setValue(*settingLayoutSorting, static_cast<int>(value));
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutRotate() const
{
return value(settingLayoutRotate, GetDefLayoutRotate()).toBool();
return value(*settingLayoutRotate, GetDefLayoutRotate()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -332,7 +334,7 @@ bool VSettings::GetDefLayoutRotate()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutRotate(bool value)
{
setValue(settingLayoutRotate, value);
setValue(*settingLayoutRotate, value);
}
//---------------------------------------------------------------------------------------------------------------------
@ -340,7 +342,7 @@ int VSettings::GetLayoutRotationIncrease() const
{
const int def = GetDefLayoutRotationIncrease();
bool ok = false;
const int r = value(settingLayoutRotationIncrease, def).toInt(&ok);
const int r = value(*settingLayoutRotationIncrease, def).toInt(&ok);
if (ok)
{
if (not (r >= 1 && r <= 180 && 360 % r == 0))
@ -367,13 +369,13 @@ int VSettings::GetDefLayoutRotationIncrease()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutRotationIncrease(int value)
{
setValue(settingLayoutRotationIncrease, value);
setValue(*settingLayoutRotationIncrease, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutAutoCrop() const
{
return value(settingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool();
return value(*settingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -385,13 +387,13 @@ bool VSettings::GetDefLayoutAutoCrop()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutAutoCrop(bool value)
{
setValue(settingLayoutAutoCrop, value);
setValue(*settingLayoutAutoCrop, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutSaveLength() const
{
return value(settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool();
return value(*settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -403,13 +405,13 @@ bool VSettings::GetDefLayoutSaveLength()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutSaveLength(bool value)
{
setValue(settingLayoutSaveLength, value);
setValue(*settingLayoutSaveLength, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutUnitePages() const
{
return value(settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool();
return value(*settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -421,13 +423,13 @@ bool VSettings::GetDefLayoutUnitePages()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutUnitePages(bool value)
{
setValue(settingLayoutUnitePages, value);
setValue(*settingLayoutUnitePages, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetIgnoreAllFields() const
{
return value(settingIgnoreFields, GetDefIgnoreAllFields()).toBool();
return value(*settingIgnoreFields, GetDefIgnoreAllFields()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -439,13 +441,13 @@ bool VSettings::GetDefIgnoreAllFields()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetIgnoreAllFields(bool value)
{
setValue(settingIgnoreFields, value);
setValue(*settingIgnoreFields, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetStripOptimization() const
{
return value(settingStripOptimization, GetDefStripOptimization()).toBool();
return value(*settingStripOptimization, GetDefStripOptimization()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -457,13 +459,13 @@ bool VSettings::GetDefStripOptimization()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetStripOptimization(bool value)
{
setValue(settingStripOptimization, value);
setValue(*settingStripOptimization, value);
}
//---------------------------------------------------------------------------------------------------------------------
quint8 VSettings::GetMultiplier() const
{
return static_cast<quint8>(value(settingMultiplier, GetDefMultiplier()).toUInt());
return static_cast<quint8>(value(*settingMultiplier, GetDefMultiplier()).toUInt());
}
//---------------------------------------------------------------------------------------------------------------------
@ -475,13 +477,13 @@ quint8 VSettings::GetDefMultiplier()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetMultiplier(quint8 value)
{
setValue(settingMultiplier, value);
setValue(*settingMultiplier, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetTextAsPaths() const
{
return value(settingTextAsPaths, GetDefTextAsPaths()).toBool();
return value(*settingTextAsPaths, GetDefTextAsPaths()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
@ -493,31 +495,31 @@ bool VSettings::GetDefTextAsPaths()
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetTextAsPaths(bool value)
{
setValue(settingTextAsPaths, value);
setValue(*settingTextAsPaths, value);
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VSettings::GetKnownMaterials() const
{
return value(settingPatternKnownMaterials, QStringList()).toStringList();
return value(*settingPatternKnownMaterials, QStringList()).toStringList();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetKnownMaterials(const QStringList &list)
{
setValue(settingPatternKnownMaterials, list);
setValue(*settingPatternKnownMaterials, list);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::IsRememberPatternMaterials() const
{
return value(settingPatternRememberMaterials, true).toBool();
return value(*settingPatternRememberMaterials, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetRememberPatternMaterials(bool value)
{
setValue(settingPatternRememberMaterials, value);
setValue(*settingPatternRememberMaterials, value);
}
// settings for the tiled PDFs
@ -534,7 +536,7 @@ QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const
// default value is 10mm. We save the margins in mm in the setting.
const QMarginsF def = QMarginsF(10, 10, 10, 10);
const QVariant val = value(settingTiledPDFMargins, QVariant::fromValue(def));
const QVariant val = value(*settingTiledPDFMargins, QVariant::fromValue(def));
if (val.canConvert<QMarginsF>())
{
@ -552,7 +554,7 @@ QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const
*/
void VSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &unit)
{
setValue(settingTiledPDFMargins, QVariant::fromValue(UnitConvertor(value, unit, Unit::Mm)));
setValue(*settingTiledPDFMargins, QVariant::fromValue(UnitConvertor(value, unit, Unit::Mm)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -566,7 +568,7 @@ qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const
{
const qreal def = 297 /*A4*/;
bool ok = false;
const qreal height = value(settingTiledPDFPaperHeight, def).toDouble(&ok);
const qreal height = value(*settingTiledPDFPaperHeight, def).toDouble(&ok);
if (ok)
{
return UnitConvertor(height, Unit::Mm, unit);
@ -585,7 +587,7 @@ qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const
*/
void VSettings::SetTiledPDFPaperHeight(qreal value, const Unit &unit)
{
setValue(settingTiledPDFPaperHeight, UnitConvertor(value, unit, Unit::Mm));
setValue(*settingTiledPDFPaperHeight, UnitConvertor(value, unit, Unit::Mm));
}
//---------------------------------------------------------------------------------------------------------------------
@ -600,7 +602,7 @@ qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const
const qreal def = 210 /*A4*/;
bool ok = false;
const qreal width = value(settingTiledPDFPaperWidth, def).toDouble(&ok);
const qreal width = value(*settingTiledPDFPaperWidth, def).toDouble(&ok);
if (ok)
{
return UnitConvertor(width, Unit::Mm, unit);
@ -619,20 +621,20 @@ qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const
*/
void VSettings::SetTiledPDFPaperWidth(qreal value, const Unit &unit)
{
setValue(settingTiledPDFPaperWidth, UnitConvertor(value,unit, Unit::Mm));
setValue(*settingTiledPDFPaperWidth, UnitConvertor(value,unit, Unit::Mm));
}
//---------------------------------------------------------------------------------------------------------------------
PageOrientation VSettings::GetTiledPDFOrientation() const
{
bool defaultValue = static_cast<bool>(PageOrientation::Portrait);
bool result = value(settingTiledPDFOrientation, defaultValue).toBool();
bool result = value(*settingTiledPDFOrientation, defaultValue).toBool();
return static_cast<PageOrientation>(result);
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetTiledPDFOrientation(PageOrientation value)
{
setValue(settingTiledPDFOrientation, static_cast<bool> (value));
setValue(*settingTiledPDFOrientation, static_cast<bool> (value));
}

View File

@ -32,11 +32,15 @@
#include <QStringData>
#include <QStringDataPtr>
#include <QVariant>
#include <QGlobalStatic>
const QString settingDataBaseGeometry = QStringLiteral("database/geometry");
namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, (QLatin1String("database/geometry")))
const QString settingDefHeight = QStringLiteral("gradation/defHeight");
const QString settingDefSize = QStringLiteral("gradation/defSize");
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefHeight, (QLatin1String("gradation/defHeight")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefSize, (QLatin1String("gradation/defSize")))
}
//---------------------------------------------------------------------------------------------------------------------
VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application,
@ -48,35 +52,35 @@ VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organiza
//---------------------------------------------------------------------------------------------------------------------
QByteArray VTapeSettings::GetDataBaseGeometry() const
{
return value(settingDataBaseGeometry).toByteArray();
return value(*settingDataBaseGeometry).toByteArray();
}
//---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDataBaseGeometry(const QByteArray &value)
{
setValue(settingDataBaseGeometry, value);
setValue(*settingDataBaseGeometry, value);
}
//---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDefHeight(int value)
{
setValue(settingDefHeight, value);
setValue(*settingDefHeight, value);
}
//---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetDefHeight() const
{
return value(settingDefHeight, 176).toInt();
return value(*settingDefHeight, 176).toInt();
}
//---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDefSize(int value)
{
setValue(settingDefSize, value);
setValue(*settingDefSize, value);
}
//---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetDefSize() const
{
return value(settingDefSize, 50).toInt();
return value(*settingDefSize, 50).toInt();
}

View File

@ -213,11 +213,13 @@ bool VPE::VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) c
QList<QUrl> tmpUrlList = data->urls();
QFileInfo tmpFileInfo;
foreach(QUrl tmpUrl, tmpUrlList)
for(const QUrl &tmpUrl : tmpUrlList)
{
if (QFile::exists(tmpUrl.toLocalFile()))
{
tmpFileInfo = QFileInfo(tmpUrl.toLocalFile()); break;
}
}
if (checkFileFilter(tmpFileInfo.fileName()))
{

View File

@ -319,12 +319,12 @@ VPE::VPropertySet *VPE::VPropertyModel::takePropertySet(VPropertySet *new_proper
if (emit_signals)
{
emit beginResetModel();
beginResetModel();
}
d_ptr->Properties = new_property_set;
if (emit_signals)
{
emit endResetModel();
endResetModel();
}
return tmpOldPropertySet;

View File

@ -105,7 +105,7 @@ QString AbstractTest::TranslationsPath() const
//---------------------------------------------------------------------------------------------------------------------
int AbstractTest::Run(int exit, const QString &program, const QStringList &arguments, QString &error, int msecs)
{
const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program).arg(arguments.join(", "));
const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program, arguments.join(", "));
QFileInfo info(program);
if (not info.exists())
@ -134,7 +134,7 @@ int AbstractTest::Run(int exit, const QString &program, const QStringList &argum
if (process->exitStatus() == QProcess::CrashExit)
{
error = QString("Program crashed.\n%1\n%2").arg(parameters).arg(QString(process->readAllStandardError()));
error = QString("Program crashed.\n%1\n%2").arg(parameters, QString(process->readAllStandardError()));
return TST_EX_CRASH;
}
@ -177,7 +177,7 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
}
else
{
if (QFileInfo(tgtFilePath).exists())
if (QFileInfo::exists(tgtFilePath))
{
const QString msg = QString("File '%1' exists.").arg(srcFilePath);
QWARN(qUtf8Printable(msg));
@ -197,7 +197,7 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
QFile srcFile(srcFilePath);
if (not srcFile.open(QFile::ReadOnly))
{
const QString msg = QString("Can't copy file '%1'. Error: %2").arg(srcFilePath).arg(srcFile.errorString());
const QString msg = QString("Can't copy file '%1'. Error: %2").arg(srcFilePath, srcFile.errorString());
QWARN(qUtf8Printable(msg));
return false;
}
@ -205,8 +205,8 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
if (not srcFile.copy(tgtFilePath))
{
const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3").arg(srcFilePath).arg(tgtFilePath)
.arg(srcFile.errorString());
const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3")
.arg(srcFilePath, tgtFilePath, srcFile.errorString());
QWARN(qUtf8Printable(msg));
return false;
}

View File

@ -134,14 +134,14 @@ void DialogEditWrongFormula::DialogAccepted()
{
formula = ui->plainTextEditFormula->toPlainText();
emit DialogClosed(QDialog::Accepted);
accepted();
emit accepted();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DialogRejected()
{
emit DialogClosed(QDialog::Rejected);
rejected();
emit rejected();
}
//---------------------------------------------------------------------------------------------------------------------
@ -492,7 +492,7 @@ void DialogEditWrongFormula::InitVariables()
void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, const QString &unit,
const QString &description)
{
const QString desc = QString("%1(%2 %3) - %4").arg(name).arg(value).arg(unit).arg(description);
const QString desc = QString("%1(%2 %3) - %4").arg(name).arg(value).arg(unit, description);
ui->labelDescription->setText(desc);
}
@ -592,8 +592,9 @@ void DialogEditWrongFormula::ShowFunctions()
ui->tableWidget->setColumnHidden(ColumnFullName, true);
ui->labelDescription->setText("");
QMap<QString, qmu::QmuTranslation>::const_iterator i = qApp->TrVars()->GetFunctions().constBegin();
while (i != qApp->TrVars()->GetFunctions().constEnd())
const QMap<QString, qmu::QmuTranslation> functions = qApp->TrVars()->GetFunctions();
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
while (i != functions.constEnd())
{
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
QTableWidgetItem *item = new QTableWidgetItem(i.value().translate(qApp->Settings()->GetLocale()));
@ -653,7 +654,8 @@ void DialogEditWrongFormula::FilterVariablesEdited(const QString &filter)
}
// show rows with matched filter
for (auto item : ui->tableWidget->findItems(filter, Qt::MatchContains))
const QList<QTableWidgetItem*> items = ui->tableWidget->findItems(filter, Qt::MatchContains);
for (auto item : items)
{
// If filter is empty findItems() for unknown reason returns nullptr items.
if (item)

View File

@ -843,8 +843,7 @@ void DialogPiecePath::InitPathTab()
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogPiecePath::NameChanged);
InitPathTypes();
connect(ui->comboBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged),
[this]()
connect(ui->comboBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
{
ui->comboBoxPenType->setEnabled(GetType() == PiecePathType::InternalPath);
ui->checkBoxCut->setEnabled(GetType() == PiecePathType::InternalPath);

View File

@ -236,8 +236,7 @@ void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
QString VToolFlippingByAxis::MakeToolTip() const
{
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>")
.arg(tr("Origin point"))
.arg(OriginPointName());
.arg(tr("Origin point"), OriginPointName());
return toolTip;
}

View File

@ -224,10 +224,7 @@ QString VToolFlippingByLine::MakeToolTip() const
{
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>"
"<tr> <td><b>%3:</b> %4</td> </tr>")
.arg(tr("First line point"))
.arg(FirstLinePointName())
.arg(tr("Second line point"))
.arg(SecondLinePointName());
.arg(tr("First line point"), FirstLinePointName(), tr("Second line point"), SecondLinePointName());
return toolTip;
}

View File

@ -689,11 +689,8 @@ QString VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const
"<tr> <td><b>%3:</b> %4 %5</td> </tr>"
"%6"
"</table>")
.arg(tr("Label"))
.arg(curve->name())
.arg(tr("Length"))
.arg(tr("Label"), curve->name(), tr("Length"))
.arg(qApp->fromPixel(curve->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(MakeToolTip());
.arg(UnitsToStr(qApp->patternUnit(), true), MakeToolTip());
return toolTip;
}

View File

@ -514,11 +514,11 @@ QString VToolMove::MakeToolTip() const
.arg(GetFormulaAngle().getDoubleValue()) // 2
.arg(tr("Length")) // 3
.arg(GetFormulaLength().getDoubleValue()) // 4
.arg(UnitsToStr(qApp->patternUnit(), true)) // 5
.arg(tr("Rotation angle")) // 6
.arg(UnitsToStr(qApp->patternUnit(), true), // 5
tr("Rotation angle")) // 6
.arg(GetFormulaRotationAngle().getDoubleValue()) // 7
.arg(tr("Rotation origin point")) // 8
.arg(OriginPointName()); // 9
.arg(tr("Rotation origin point"), // 8
OriginPointName()); // 9
return toolTip;
}

View File

@ -374,9 +374,7 @@ QString VToolRotation::MakeToolTip() const
{
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>"
"<tr> <td><b>%3:</b> %4°</td> </tr>")
.arg(tr("Origin point"))
.arg(OriginPointName())
.arg(tr("Rotation angle"))
.arg(tr("Origin point"), OriginPointName(), tr("Rotation angle"))
.arg(GetFormulaAngle().getDoubleValue());
return toolTip;
}

View File

@ -202,9 +202,7 @@ QString VAbstractSpline::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curve->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Label"))
.arg(curve->name());
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Label"), curve->name());
return toolTip;
}

View File

@ -387,14 +387,12 @@ QString VToolArc::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(arc->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Radius"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius"))
.arg(qApp->fromPixel(arc->GetRadius()))
.arg(tr("Start angle"))
.arg(qApp->fromPixel(arc->GetStartAngle()))
.arg(tr("End angle"))
.arg(qApp->fromPixel(arc->GetEndAngle()))
.arg(tr("Label"))
.arg(arc->name());
.arg(tr("Label"), arc->name());
return toolTip;
}

View File

@ -365,14 +365,12 @@ QString VToolArcWithLength::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(arc->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Radius"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius"))
.arg(qApp->fromPixel(arc->GetRadius()))
.arg(tr("Start angle"))
.arg(qApp->fromPixel(arc->GetStartAngle()))
.arg(tr("End angle"))
.arg(qApp->fromPixel(arc->GetEndAngle()))
.arg(tr("Label"))
.arg(arc->name());
.arg(tr("Label"), arc->name());
return toolTip;
}

View File

@ -440,8 +440,8 @@ QString VToolEllipticalArc::MakeToolTip() const
"</table>")
.arg(tr("Length")) // 1
.arg(qApp->fromPixel(elArc->GetLength())) // 2
.arg(UnitsToStr(qApp->patternUnit(), true)) // 3
.arg(tr("Radius") + QLatin1String("1")) // 4
.arg(UnitsToStr(qApp->patternUnit(), true), // 3
tr("Radius") + QLatin1String("1")) // 4
.arg(qApp->fromPixel(elArc->GetRadius1())) // 5
.arg(tr("Radius") + QLatin1String("2")) // 6
.arg(qApp->fromPixel(elArc->GetRadius2())) // 7
@ -449,9 +449,9 @@ QString VToolEllipticalArc::MakeToolTip() const
.arg(elArc->GetStartAngle()) // 9
.arg(tr("End angle")) // 10
.arg(elArc->GetEndAngle()) // 11
.arg(tr("Label")) // 12
.arg(elArc->name()) // 13
.arg(tr("Rotation")) // 14
.arg(tr("Label"), // 12
elArc->name(), // 13
tr("Rotation")) // 14
.arg(elArc->GetRotationAngle()); // 15
return toolTip;
}

View File

@ -273,15 +273,13 @@ QString VToolCutArc::MakeToolTip() const
"<tr> <td><b>%8:</b> %9°</td> </tr>")
.arg(arcStr + arcNumber + QLatin1String(" ") + lengthStr)
.arg(qApp->fromPixel(arc.GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(arcStr + arcNumber + QLatin1String(" ") + radiusStr)
.arg(UnitsToStr(qApp->patternUnit(), true), arcStr + arcNumber + QLatin1String(" ") + radiusStr)
.arg(qApp->fromPixel(arc.GetRadius()))
.arg(arcStr + arcNumber + QLatin1String(" ") + startAngleStr)
.arg(qApp->fromPixel(arc.GetStartAngle()))
.arg(arcStr + arcNumber + QLatin1String(" ") + endAngleStr)
.arg(qApp->fromPixel(arc.GetEndAngle()))
.arg(arcStr + arcNumber + QLatin1String(" ") + tr("label"))
.arg(arc.name());
.arg(arcStr + arcNumber + QLatin1String(" ") + tr("label"), arc.name());
return toolTip;
};

View File

@ -269,13 +269,10 @@ QString VToolCutSpline::MakeToolTip() const
"</table>")
.arg(curveStr + QLatin1String("1 ") + lengthStr)
.arg(qApp->fromPixel(spline1.GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(curveStr + QLatin1String("2 ") + lengthStr)
.arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr)
.arg(qApp->fromPixel(spline2.GetLength()))
.arg(curveStr + QLatin1String(" 1") + tr("label"))
.arg(spline1.name())
.arg(curveStr + QLatin1String(" 2") + tr("label"))
.arg(spline2.name());
.arg(curveStr + QLatin1String(" 1") + tr("label"), spline1.name(),
curveStr + QLatin1String(" 2") + tr("label"), spline2.name());
return toolTip;
}

View File

@ -359,13 +359,10 @@ QString VToolCutSplinePath::MakeToolTip() const
"</table>")
.arg(curveStr + QLatin1String("1 ") + lengthStr)
.arg(qApp->fromPixel(splPath1->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(curveStr + QLatin1String("2 ") + lengthStr)
.arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr)
.arg(qApp->fromPixel(splPath2->GetLength()))
.arg(curveStr + QLatin1String(" 1") + tr("label"))
.arg(splPath1->name())
.arg(curveStr + QLatin1String(" 2") + tr("label"))
.arg(splPath2->name());
.arg(curveStr + QLatin1String(" 1") + tr("label"), splPath1->name(),
curveStr + QLatin1String(" 2") + tr("label"), splPath2->name());
delete splPath1;
delete splPath2;

View File

@ -162,14 +162,12 @@ QString VToolAlongLine::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curLine.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Angle"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(curLine.angle())
.arg(QString("%1->%2").arg(basePoint->name(), current->name()))
.arg(QString("%1->%2").arg(current->name(), secondPoint->name()))
.arg(QString("%1->%2").arg(basePoint->name(), current->name()),
QString("%1->%2").arg(current->name(), secondPoint->name()))
.arg(qApp->fromPixel(curToSecond.length()))
.arg(tr("Label"))
.arg(current->name());
.arg(tr("Label"), current->name());
return toolTip;
}

View File

@ -281,15 +281,13 @@ QString VToolHeight::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curLine.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Angle"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(curLine.angle())
.arg(QString("%1->%2").arg(p1Line->name(), current->name()))
.arg(qApp->fromPixel(p1ToCur.length()))
.arg(QString("%1->%2").arg(p2Line->name(), current->name()))
.arg(qApp->fromPixel(p2ToCur.length()))
.arg(tr("Label"))
.arg(current->name());
.arg(tr("Label"), current->name());
return toolTip;
}

View File

@ -326,14 +326,12 @@ QString VToolLineIntersectAxis::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curLine.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Angle"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(curLine.angle())
.arg(QString("%1->%2").arg(firstPoint->name(), current->name()))
.arg(qApp->fromPixel(firstToCur.length()))
.arg(QString("%1->%2").arg(current->name(), secondPoint->name()))
.arg(qApp->fromPixel(curToSecond.length()))
.arg(tr("Label"))
.arg(current->name());
.arg(tr("Label"), current->name());
return toolTip;
}

View File

@ -158,11 +158,9 @@ QString VToolLinePoint::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(line.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Angle"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(line.angle())
.arg(tr("Label"))
.arg(second->name());
.arg(tr("Label"), second->name());
return toolTip;
}

View File

@ -339,13 +339,11 @@ QString VToolShoulderPoint::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(firstToCur.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Angle"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(firstToCur.angle())
.arg(QString("%1->%2").arg(second->name(), current->name()))
.arg(qApp->fromPixel(secondToCur.length()))
.arg(tr("Label"))
.arg(current->name());
.arg(tr("Label"), current->name());
return toolTip;
}

View File

@ -262,7 +262,7 @@ void VToolBasePoint::SetBasePointPos(const QPointF &pos)
void VToolBasePoint::DeleteToolWithConfirm(bool ask)
{
qCDebug(vTool, "Deleting base point.");
qApp->getSceneView()->itemClicked(nullptr);
emit qApp->getSceneView()->itemClicked(nullptr);
if (ask)
{
qCDebug(vTool, "Asking.");
@ -370,8 +370,7 @@ QString VToolBasePoint::MakeToolTip() const
const QString toolTip = QString("<table>"
"<tr> <td><b>%1:</b> %2</td> </tr>"
"</table>")
.arg(tr("Label"))
.arg(point->name());
.arg(tr("Label"), point->name());
return toolTip;
}

View File

@ -312,15 +312,13 @@ QString VToolLineIntersect::MakeToolTip() const
"</table>")
.arg(QString("%1->%2").arg(p1L1->name(), current->name()))
.arg(qApp->fromPixel(p1L1ToCur.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(QString("%1->%2").arg(current->name(), p2L1->name()))
.arg(UnitsToStr(qApp->patternUnit(), true), QString("%1->%2").arg(current->name(), p2L1->name()))
.arg(qApp->fromPixel(curToP2L1.length()))
.arg(QString("%1->%2").arg(p1L2->name(), current->name()))
.arg(qApp->fromPixel(p1L2ToCur.length()))
.arg(QString("%1->%2").arg(current->name(), p2L2->name()))
.arg(qApp->fromPixel(curToP2L2.length()))
.arg(tr("Label"))
.arg(current->name());
.arg(tr("Label"), current->name());
return toolTip;
}

View File

@ -353,15 +353,13 @@ QString VToolPointOfContact::MakeToolTip() const
"</table>")
.arg(QString("%1->%2").arg(p1->name(), current->name()))
.arg(qApp->fromPixel(p1ToCur.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(QString("%1->%2").arg(p2->name(), current->name()))
.arg(UnitsToStr(qApp->patternUnit(), true), QString("%1->%2").arg(p2->name(), current->name()))
.arg(qApp->fromPixel(p2ToCur.length()))
.arg(QString("%1 %2->%3").arg(tr("Length"), centerP->name(), current->name()))
.arg(qApp->fromPixel(centerToCur.length()))
.arg(QString("%1 %2->%3").arg(tr("Angle"), centerP->name(), current->name()))
.arg(centerToCur.angle())
.arg(tr("Label"))
.arg(current->name());
.arg(tr("Label"), current->name());
return toolTip;
}

View File

@ -193,7 +193,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
if (selectedAction == actionOption)
{
qCDebug(vTool, "Show options.");
qApp->getSceneView()->itemClicked(nullptr);
emit qApp->getSceneView()->itemClicked(nullptr);
m_dialog = QSharedPointer<Dialog>(new Dialog(getData(), m_id, qApp->getMainWindow()));
m_dialog->setModal(true);

View File

@ -442,8 +442,7 @@ QString VToolLine::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(line.length()))
.arg(UnitsToStr(qApp->patternUnit(), true))
.arg(tr("Angle"))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(line.angle());
return toolTip;
}

View File

@ -214,7 +214,7 @@ void VAbstractTool::DeleteToolWithConfirm(bool ask)
if (_referens <= 1)
{
qCDebug(vTool, "No children.");
qApp->getSceneView()->itemClicked(nullptr);
emit qApp->getSceneView()->itemClicked(nullptr);
if (ask)
{
qCDebug(vTool, "Asking.");

View File

@ -92,7 +92,7 @@ void AddGroup::undo()
}
VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView());
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -78,7 +78,7 @@ void AddToCalc::undo()
}
emit NeedFullParsing();
VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView());
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,7 +125,7 @@ void AddToCalc::RedoFullParsing()
if (redoFlag)
{
emit NeedFullParsing();
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
}
else
{

View File

@ -58,7 +58,7 @@ void DelGroup::undo()
{
qCDebug(vUndo, "Undo.");
doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
QDomElement groups = doc->CreateGroups();
if (not groups.isNull())
@ -82,7 +82,7 @@ void DelGroup::redo()
qCDebug(vUndo, "Redo.");
//Keep first!
doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
QDomElement groups = doc->CreateGroups();
if (not groups.isNull())
{

View File

@ -59,7 +59,7 @@ void DelTool::undo()
UndoDeleteAfterSibling(parentNode, siblingId);
emit NeedFullParsing();
//Keep last!
doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
}
//---------------------------------------------------------------------------------------------------------------------
@ -68,7 +68,7 @@ void DelTool::redo()
qCDebug(vUndo, "Redo.");
//Keep first!
doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change
QDomElement domElement = doc->NodeById(nodeId);
parentNode.removeChild(domElement);
emit NeedFullParsing();

View File

@ -175,8 +175,7 @@ void VisToolMove::RefreshGeometry()
Visualization::toolTip = tr("Length = %1%2, angle = %3°, <b>Shift</b> - sticking angle, "
"<b>Mouse click</b> - finish selecting a position")
.arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(tempLength)),
qApp->Settings()->GetOsSeparator()))
.arg(prefix)
qApp->Settings()->GetOsSeparator()), prefix)
.arg(tempAngle);
}
else
@ -184,8 +183,7 @@ void VisToolMove::RefreshGeometry()
Visualization::toolTip = tr("Length = %1%2, angle = %3°, rotation angle = %4°, <b>Shift</b> - sticking angle, "
"<b>Ctrl</b> - change rotation origin point, <b>Mouse click</b> - finish creating")
.arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(tempLength)),
qApp->Settings()->GetOsSeparator()))
.arg(prefix)
qApp->Settings()->GetOsSeparator()), prefix)
.arg(tempAngle)
.arg(tempRoationAngle);
}

View File

@ -83,8 +83,7 @@ void VisToolEndLine::RefreshGeometry()
"<b>Shift</b> - sticking angle, <b>Enter</b> - finish creation")
.arg(this->line().angle())
.arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length())),
qApp->Settings()->GetOsSeparator()))
.arg(prefix);
qApp->Settings()->GetOsSeparator()), prefix);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -57,7 +57,7 @@ bool VAbstractMainWindow::ContinueFormatRewrite(const QString &currentFormatVers
msgBox.setText(tr("This file is using previous format version v%1. The current is v%2. "
"Saving the file with this app version will update the format version for this "
"file. This may prevent you from be able to open the file with older app versions. "
"Do you really want to continue?").arg(currentFormatVersion).arg(maxFormatVersion));
"Do you really want to continue?").arg(currentFormatVersion, maxFormatVersion));
msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
msgBox.setDefaultButton(QDialogButtonBox::No);
msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32));

View File

@ -31,8 +31,12 @@
#include "../vmisc/logging.h"
#include <QtTest>
#include <QGlobalStatic>
const QString tmpTestFolder = QStringLiteral("tst_tape_tmp");
namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestFolder, (QLatin1String("tst_tape_tmp")))
}
//---------------------------------------------------------------------------------------------------------------------
TST_TapeCommandLine::TST_TapeCommandLine(QObject *parent)
@ -43,14 +47,14 @@ TST_TapeCommandLine::TST_TapeCommandLine(QObject *parent)
//---------------------------------------------------------------------------------------------------------------------
void TST_TapeCommandLine::initTestCase()
{
QDir tmpDir(tmpTestFolder);
QDir tmpDir(*tmpTestFolder);
if (not tmpDir.removeRecursively())
{
QFAIL("Fail to remove temp directory.");
}
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + QStringLiteral("tst_tape"),
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder))
{
QFAIL("Fail to prepare files for testing.");
}
@ -117,8 +121,8 @@ void TST_TapeCommandLine::OpenMeasurements()
QString error;
const int exit = Run(exitCode, TapePath(), QStringList() << "--test"
<< QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() +
file, error);
<< QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder +
QDir::separator() + file, error);
QVERIFY2(exit == exitCode, qUtf8Printable(error));
}
@ -126,7 +130,7 @@ void TST_TapeCommandLine::OpenMeasurements()
//---------------------------------------------------------------------------------------------------------------------
void TST_TapeCommandLine::cleanupTestCase()
{
QDir tmpDir(tmpTestFolder);
QDir tmpDir(*tmpTestFolder);
if (not tmpDir.removeRecursively())
{
QWARN("Fail to remove temp directory.");

View File

@ -31,9 +31,13 @@
#include "../vmisc/logging.h"
#include <QtTest>
#include <QGlobalStatic>
const QString tmpTestFolder = QStringLiteral("tst_valentina_tmp");
const QString tmpTestCollectionFolder = QStringLiteral("tst_valentina_collection_tmp");
namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestFolder, (QLatin1String("tst_valentina_tmp")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestCollectionFolder, (QLatin1String("tst_valentina_collection_tmp")))
}
TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
:AbstractTest(parent)
@ -45,7 +49,7 @@ TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
void TST_ValentinaCommandLine::initTestCase()
{
{// Test files
QDir tmpDir(tmpTestFolder);
QDir tmpDir(*tmpTestFolder);
if (not tmpDir.removeRecursively())
{
QFAIL("Fail to remove test temp directory.");
@ -53,14 +57,14 @@ void TST_ValentinaCommandLine::initTestCase()
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() +
QLatin1String("tst_valentina"),
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder))
{
QFAIL("Fail to prepare test files for testing.");
}
}
{// Collection
QDir tmpDir(tmpTestCollectionFolder);
QDir tmpDir(*tmpTestCollectionFolder);
if (not tmpDir.removeRecursively())
{
QFAIL("Fail to remove collection temp directory.");
@ -68,7 +72,7 @@ void TST_ValentinaCommandLine::initTestCase()
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() +
QLatin1String("tst_valentina_collection"),
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder))
QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder))
{
QFAIL("Fail to prepare collection files for testing.");
}
@ -104,7 +108,7 @@ void TST_ValentinaCommandLine::OpenPatterns()
QFETCH(int, exitCode);
QString error;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
const int exit = Run(exitCode, ValentinaPath(), QStringList() << "--test"
<< tmp + QDir::separator() + file, error);
@ -119,7 +123,7 @@ void TST_ValentinaCommandLine::ExportMode_data() const
QTest::addColumn<QString>("arguments");
QTest::addColumn<int>("exitCode");
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
QTest::newRow("Issue #372")<< "issue_372.val"
<< QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp)
@ -155,7 +159,7 @@ void TST_ValentinaCommandLine::ExportMode()
QFETCH(int, exitCode);
QString error;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;");
const int exit = Run(exitCode, ValentinaPath(), arg, error);
@ -170,7 +174,7 @@ void TST_ValentinaCommandLine::TestMode_data() const
QTest::addColumn<QString>("arguments");
QTest::addColumn<int>("exitCode");
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
QTest::newRow("Issue #256. Correct path.")<< "issue_256.val"
<< QString("--test")
@ -213,7 +217,7 @@ void TST_ValentinaCommandLine::TestMode()
QFETCH(int, exitCode);
QString error;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;");
const int exit = Run(exitCode, ValentinaPath(), arg, error);
@ -228,7 +232,7 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const
QTest::addColumn<QString>("arguments");
QTest::addColumn<int>("exitCode");
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder;
const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst"));
const QString keyTest = QStringLiteral("--test");
@ -274,7 +278,7 @@ void TST_ValentinaCommandLine::TestOpenCollection()
QFETCH(int, exitCode);
QString error;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder;
const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;");
const int exit = Run(exitCode, ValentinaPath(), arg, error);
@ -287,7 +291,7 @@ void TST_ValentinaCommandLine::TestOpenCollection()
void TST_ValentinaCommandLine::cleanupTestCase()
{
{
QDir tmpDir(tmpTestFolder);
QDir tmpDir(*tmpTestFolder);
if (not tmpDir.removeRecursively())
{
QWARN("Fail to remove test temp directory.");
@ -295,7 +299,7 @@ void TST_ValentinaCommandLine::cleanupTestCase()
}
{
QDir tmpDir(tmpTestCollectionFolder);
QDir tmpDir(*tmpTestCollectionFolder);
if (not tmpDir.removeRecursively())
{
QWARN("Fail to remove collection temp directory.");

View File

@ -61,9 +61,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale)
if (QFileInfo(path+QLatin1String("/")+file).size() <= 34)
{
const QString message = QString("Translation variables for locale = %1 is empty. \nFull path: %2/%3")
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedLocale, path, file);
QWARN(qUtf8Printable(message));
return ErrorSize;
@ -74,9 +72,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale)
if (not m_vTranslator->load(file, path))
{
const QString message = QString("Can't load translation variables for locale = %1. \nFull path: %2/%3")
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedLocale, path, file);
QWARN(qUtf8Printable(message));
delete m_vTranslator;
@ -87,9 +83,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale)
if (not QCoreApplication::installTranslator(m_vTranslator))
{
const QString message = QString("Can't install translation variables for locale = %1. \nFull path: %2/%3")
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedLocale, path, file);
QWARN(qUtf8Printable(message));
delete m_vTranslator;
@ -153,7 +147,7 @@ void TST_AbstractRegExp::CallTestCheckRegExpNames()
const QString translated = m_trMs->VarToUser(originalName);
if (not re.match(translated).hasMatch())
{
const QString message = QString("Original name:'%1', translated name:'%2'").arg(originalName).arg(translated);
const QString message = QString("Original name:'%1', translated name:'%2'").arg(originalName, translated);
QFAIL(qUtf8Printable(message));
}
}
@ -169,7 +163,7 @@ void TST_AbstractRegExp::CallTestCheckIsNamesUnique()
if (names.contains(translated))
{
const QString message = QString("Name is not unique. Original name:'%1', translated name:'%2'")
.arg(originalName).arg(translated);
.arg(originalName, translated);
QFAIL(qUtf8Printable(message));
}
names.insert(translated);
@ -190,7 +184,7 @@ void TST_AbstractRegExp::CallTestCheckNoOriginalNamesInTranslation()
{
const QString message = QString("Translation repeat original name from other place. "
"Original name:'%1', translated name:'%2'")
.arg(originalName).arg(translated);
.arg(originalName, translated);
QFAIL(qUtf8Printable(message));
}
}

View File

@ -52,17 +52,17 @@ TST_AbstractTranslation::TST_AbstractTranslation(QObject *parent)
QDomNodeList TST_AbstractTranslation::LoadTSFile(const QString &filename)
{
tsFile.reset();
tsFile = QSharedPointer<QFile>(new QFile(QString("%1/%2").arg(TS_DIR).arg(filename)));
tsFile = QSharedPointer<QFile>(new QFile(QString("%1/%2").arg(TS_DIR, filename)));
if (not tsFile->exists())
{
const QString message = QString("Can't find '%1'.\n%2.").arg(filename).arg(tsFile->errorString());
const QString message = QString("Can't find '%1'.\n%2.").arg(filename, tsFile->errorString());
QWARN(qUtf8Printable(message));
return QDomNodeList();
}
if (tsFile->open(QIODevice::ReadOnly) == false)
{
const QString message = QString("Can't open file '%1'.\n%2.").arg(filename).arg(tsFile->errorString());
const QString message = QString("Can't open file '%1'.\n%2.").arg(filename, tsFile->errorString());
QWARN(qUtf8Printable(message));
return QDomNodeList();
}

View File

@ -156,7 +156,7 @@ void TST_BuitInRegExp::TestCheckUnderlineExists_data()
auto i = data.constBegin();
while (i != data.constEnd())
{
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale).arg(i.key());
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, i.key());
QTest::newRow(qUtf8Printable(tag)) << i.key() << i.value();
++i;
}
@ -172,7 +172,7 @@ void TST_BuitInRegExp::TestCheckUnderlineExists()
if ((translated.right(1) == QLatin1String("_")) != exists)
{
const QString message = QString("String '%1' doesn't contain underline. Original string is '%2'")
.arg(translated).arg(name);
.arg(translated, name);
QFAIL(qUtf8Printable(message));
}
}
@ -185,7 +185,7 @@ void TST_BuitInRegExp::TestCheckInternalVaribleRegExp_data()
foreach(const QString &var, builInVariables)
{
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale).arg(var);
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var);
const QStringList originalNames = AllNames();
foreach(const QString &str, originalNames)
{
@ -256,7 +256,7 @@ void TST_BuitInRegExp::PrepareData()
foreach(const QString &str, originalNames)
{
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale).arg(str);
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, str);
QTest::newRow(qUtf8Printable(tag)) << str;
}
}

View File

@ -81,16 +81,14 @@ void TST_MeasurementRegExp::initTestCase()
if (LoadMeasurements(m_system, m_locale) != NoError)
{
const QString message = QString("Couldn't load measurements. System = %1, locale = %2")
.arg(m_system)
.arg(m_locale);
.arg(m_system, m_locale);
QSKIP(qUtf8Printable(message));
}
if (LoadVariables(m_locale) != NoError)
{
const QString message = QString("Couldn't load variables. System = %1, locale = %2")
.arg(m_system)
.arg(m_locale);
.arg(m_system, m_locale);
QSKIP(qUtf8Printable(message));
}
@ -172,7 +170,7 @@ void TST_MeasurementRegExp::PrepareData()
foreach(const QString &str, originalNames)
{
const QString tag = QString("System: '%1', locale: '%2'. Name '%3'").arg(m_system).arg(m_locale).arg(str);
const QString tag = QString("System: '%1', locale: '%2'. Name '%3'").arg(m_system, m_locale, str);
QTest::newRow(qUtf8Printable(tag)) << str;
}
}
@ -187,15 +185,12 @@ QStringList TST_MeasurementRegExp::AllNames()
int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const QString &checkedLocale)
{
const QString path = TranslationsPath();
const QString file = QString("measurements_%1_%2.qm").arg(checkedSystem).arg(checkedLocale);
const QString file = QString("measurements_%1_%2.qm").arg(checkedSystem, checkedLocale);
if (QFileInfo(path+QLatin1String("/")+file).size() <= 34)
{
const QString message = QString("Translation for system = %1 and locale = %2 is empty. \nFull path: %3/%4")
.arg(checkedSystem)
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedSystem, checkedLocale, path, file);
QWARN(qUtf8Printable(message));
return ErrorSize;
@ -207,10 +202,7 @@ int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const
if (not m_pmsTranslator->load(file, path))
{
const QString message = QString("Can't load translation for system = %1 and locale = %2. \nFull path: %3/%4")
.arg(checkedSystem)
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedSystem, checkedLocale, path, file);
QWARN(qUtf8Printable(message));
delete m_pmsTranslator;
@ -221,10 +213,7 @@ int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const
if (not QCoreApplication::installTranslator(m_pmsTranslator))
{
const QString message = QString("Can't install translation for system = %1 and locale = %2. \nFull path: %3/%4")
.arg(checkedSystem)
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedSystem, checkedLocale, path, file);
QWARN(qUtf8Printable(message));
delete m_pmsTranslator;
@ -245,8 +234,7 @@ void TST_MeasurementRegExp::RemoveTrMeasurements(const QString &checkedSystem, c
if (result == false)
{
const QString message = QString("Can't remove translation for system = %1 and locale = %2")
.arg(checkedSystem)
.arg(checkedLocale);
.arg(checkedSystem, checkedLocale);
QWARN(qUtf8Printable(message));
}
delete m_pmsTranslator;

View File

@ -155,9 +155,7 @@ int TST_QmuParserErrorMsg::LoadTranslation(const QString &checkedLocale)
if (QFileInfo(path+QLatin1String("/")+file).size() <= 34)
{
const QString message = QString("Translation for locale = %1 is empty. \nFull path: %2/%3")
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedLocale, path, file);
QWARN(qUtf8Printable(message));
return ErrorSize;
@ -168,9 +166,7 @@ int TST_QmuParserErrorMsg::LoadTranslation(const QString &checkedLocale)
if (not appTranslator->load(file, path))
{
const QString message = QString("Can't load translation for locale = %1. \nFull path: %2/%3")
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedLocale, path, file);
QWARN(qUtf8Printable(message));
delete appTranslator;
@ -181,9 +177,7 @@ int TST_QmuParserErrorMsg::LoadTranslation(const QString &checkedLocale)
if (not QCoreApplication::installTranslator(appTranslator))
{
const QString message = QString("Can't install translation for locale = %1. \nFull path: %2/%3")
.arg(checkedLocale)
.arg(path)
.arg(file);
.arg(checkedLocale, path, file);
QWARN(qUtf8Printable(message));
delete appTranslator;

View File

@ -77,8 +77,7 @@ void TST_TSLocaleTranslation::CheckPlaceMarkerExist_data()
continue;
}
const QString message = QString("File '%1'. Check place holder source message '%2'").arg(filename)
.arg(source);
const QString message = QString("File '%1'. Check place holder source message '%2'").arg(filename, source);
QTest::newRow(qUtf8Printable(message)) << source << translation;
}
else

View File

@ -79,8 +79,7 @@ void TST_TSTranslation::CheckEnglishLocalization_data()
continue;
}
const QString message = QString("File '%1'. Check modification source message '%2'.").arg(fileName)
.arg(source);
const QString message = QString("File '%1'. Check modification source message '%2'.").arg(fileName, source);
QTest::newRow(qUtf8Printable(message)) << source << translation;
}
else
@ -197,8 +196,7 @@ void TST_TSTranslation::PrepareOriginalStrings()
continue;
}
const QString tag = QString("File '%1'. Check modification source message '%2'.").arg(fileName)
.arg(source);
const QString tag = QString("File '%1'. Check modification source message '%2'.").arg(fileName, source);
QTest::newRow(qUtf8Printable(tag)) << source << message;
}
else

View File

@ -115,19 +115,19 @@ void TST_QmuTokenParser::PrepareVal(qreal val, const QLocale &locale)
{
const QString formula = locale.toString(val);
QString string = formula;
QString tag = QString("%1. String '%2'").arg(locale.name()).arg(string);
QString tag = QString("%1. String '%2'").arg(locale.name(), string);
QTest::newRow(qUtf8Printable(tag)) << string << true << locale;
string = formula+QLatin1String("+");
tag = QString("%1. String '%2'").arg(locale.name()).arg(string);
tag = QString("%1. String '%2'").arg(locale.name(), string);
QTest::newRow(qUtf8Printable(tag)) << string << false << locale;
string = formula+QLatin1String("+")+formula;
tag = QString("%1. String '%2'").arg(locale.name()).arg(string);
tag = QString("%1. String '%2'").arg(locale.name(), string);
QTest::newRow(qUtf8Printable(tag)) << string << false << locale;
string = formula+QString("+б");
tag = QString("%1. String '%2'").arg(locale.name()).arg(string);
tag = QString("%1. String '%2'").arg(locale.name(), string);
QTest::newRow(qUtf8Printable(tag)) << string << false << locale;
}

View File

@ -125,7 +125,7 @@ void TST_ReadVal::PrepareVal(qreal val, const QLocale &locale)
//---------------------------------------------------------------------------------------------------------------------
void TST_ReadVal::PrepareString(const QString &str, const QLocale &locale, qreal val, int count)
{
const QString tag = QString("%1. String '%2'").arg(locale.name()).arg(str);
const QString tag = QString("%1. String '%2'").arg(locale.name(), str);
QTest::newRow(qUtf8Printable(tag)) << str << count << val << locale;
}

View File

@ -49,8 +49,8 @@ void TST_VLockGuard::TryLock() const
VlpCreateLock(lock, fileName);
fileName = lock->GetLockFile();
QVERIFY2(QFileInfo(fileName).exists(), "Lock file doesn't exist!");
QVERIFY2(QFileInfo::exists(fileName), "Lock file doesn't exist!");
lock.reset();
QVERIFY2(not QFileInfo(fileName).exists(), "Lock file still exists!");
QVERIFY2(not QFileInfo::exists(fileName), "Lock file still exists!");
}

View File

@ -166,7 +166,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile()
QString error;
const bool result = m->SaveDocument(fileName, error);
const QString message = QString("Error: %1 for code=%2").arg(error).arg(listSystems.at(i));
const QString message = QString("Error: %1 for code=%2").arg(error, listSystems.at(i));
QVERIFY2(result, qUtf8Printable(message));
}
else
@ -180,7 +180,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile()
}
catch (VException &e)
{
const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage()).arg(listSystems.at(i));
const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage(), listSystems.at(i));
QFAIL(qUtf8Printable(message));
}
}
@ -217,7 +217,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile()
QString error;
const bool result = m->SaveDocument(fileName, error);
const QString message = QString("Error: %1 for code=%2").arg(error).arg(listSystems.at(i));
const QString message = QString("Error: %1 for code=%2").arg(error, listSystems.at(i));
QVERIFY2(result, qUtf8Printable(message));
}
else
@ -231,7 +231,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile()
}
catch (VException &e)
{
const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage()).arg(listSystems.at(i));
const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage(), listSystems.at(i));
QFAIL(qUtf8Printable(message));
}
}

View File

@ -146,7 +146,7 @@ void TST_VTranslateVars::PrepareVal(const QString &inputFormula, const QString &
auto PREPARE_CASE = [locale](const QString &inputString, const QString &outputString)
{
QString tag = QString("%1. String '%2'").arg(locale.name()).arg(inputString);
QString tag = QString("%1. String '%2'").arg(locale.name(), inputString);
QTest::newRow(qUtf8Printable(tag)) << inputString << outputString << locale;
};