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,6 +147,10 @@ defineReplace(set_PCH){
} }
defineReplace(enable_ccache){ defineReplace(enable_ccache){
*clang*:clazy {
QMAKE_CXX = clazy
export(QMAKE_CXX) # export value to global variable.
} else {
no_ccache{ # For enable run qmake with CONFIG+=no_ccache no_ccache{ # For enable run qmake with CONFIG+=no_ccache
$$set_PCH() $$set_PCH()
} else { } else {
@ -171,6 +175,7 @@ defineReplace(enable_ccache){
$$set_PCH() $$set_PCH()
} }
} }
}
return(true) return(true)
} }

View File

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

View File

@ -130,7 +130,7 @@ void DialogAboutTape::RetranslateUi()
ui->label_QT_Version->setText(buildCompatibilityString()); ui->label_QT_Version->setText(buildCompatibilityString());
const QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); 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", ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
"The program is provided AS IS with NO WARRANTY OF ANY " "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 QString imgUrl("<img src=\"wrong.png\" align=\"center\"/>"); // In case of error
const QString filePath = QString("://diagrams/%1.svg").arg(MapDiagrams(qApp->TrVars(), number)); const QString filePath = QString("://diagrams/%1.svg").arg(MapDiagrams(qApp->TrVars(), number));
if (QFileInfo(filePath).exists()) if (QFileInfo::exists(filePath))
{ {
// Load your SVG // Load your SVG
QSvgRenderer renderer; 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>" "normal\"> %1 <br clear=\"left\"><b>%2</b>. <i>%3</i></p>"
"<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: " "<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: "
"normal\">%4</p>") "normal\">%4</p>")
.arg(imgTag) .arg(imgTag, number, qApp->TrVars()->GuiText(name), qApp->TrVars()->Description(name));
.arg(number)
.arg(qApp->TrVars()->GuiText(name))
.arg(qApp->TrVars()->Description(name));
return text; return text;
} }

View File

@ -41,7 +41,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(schema); Q_INIT_RESOURCE(schema);
Q_INIT_RESOURCE(flags); 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) #if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole(); VAbstractApplication::WinAttachConsole();

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
ui->label_QT_Version->setText(buildCompatibilityString()); ui->label_QT_Version->setText(buildCompatibilityString());
QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); 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", ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
"The program is provided AS IS with NO WARRANTY OF ANY " "The program is provided AS IS with NO WARRANTY OF ANY "

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(icons); Q_INIT_RESOURCE(icons);
Q_INIT_RESOURCE(toolicon); 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) #if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole(); VAbstractApplication::WinAttachConsole();

View File

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

View File

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

View File

@ -1082,7 +1082,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList &params) const
QFile f(params.last()); QFile f(params.last());
if (f.exists() == false) 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); QMessageBox msgBox(QMessageBox::Critical, tr("Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default);
msgBox.exec(); msgBox.exec();
} }

View File

@ -43,6 +43,7 @@
#include <QtDebug> #include <QtDebug>
#include <QSslConfiguration> #include <QSslConfiguration>
#include <QDir> #include <QDir>
#include <QGlobalStatic>
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../ifc/xml/vabstractconverter.h" #include "../ifc/xml/vabstractconverter.h"
@ -54,8 +55,10 @@
namespace namespace
{ {
const QString defaultFeedURL = QStringLiteral("https://valentinaproject.bitbucket.io/Appcast.xml"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL,
const QString testFeedURL = QStringLiteral("https://valentinaproject.bitbucket.io/Appcast_testing.xml"); (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; QPointer<FvUpdater> FvUpdater::m_Instance;
@ -86,7 +89,7 @@ void FvUpdater::drop()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString FvUpdater::CurrentFeedURL() 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; throw *this;
} }
//---------------------------------------------------------------------------------------------------------------------
const char* VException::what() const V_NOEXCEPT_EXPR (true)
{
return error.toUtf8().constData();
}
//-----------------------------------------VExceptionToolWasDeleted---------------------------------------------------- //-----------------------------------------VExceptionToolWasDeleted----------------------------------------------------
VExceptionToolWasDeleted::VExceptionToolWasDeleted(const QString &error) VExceptionToolWasDeleted::VExceptionToolWasDeleted(const QString &error)
:VException(error) :VException(error)

View File

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

View File

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

View File

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

View File

@ -633,7 +633,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
// cppcheck-suppress ConfigurationNotChecked // cppcheck-suppress ConfigurationNotChecked
if (pattern.open(QIODevice::ReadOnly) == false) 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); throw VException(errorMsg);
} }
@ -642,7 +642,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
if (fileSchema.open(QIODevice::ReadOnly) == false) if (fileSchema.open(QIODevice::ReadOnly) == false)
{ {
pattern.close(); 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); throw VException(errorMsg);
} }
@ -693,7 +693,7 @@ void VDomDocument::setXMLContent(const QString &fileName)
// cppcheck-suppress ConfigurationNotChecked // cppcheck-suppress ConfigurationNotChecked
if (file.open(QIODevice::ReadOnly) == false) 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); throw VException(errorMsg);
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -39,6 +39,7 @@
#include <QStaticStringData> #include <QStaticStringData>
#include <QStringData> #include <QStringData>
#include <QStringDataPtr> #include <QStringDataPtr>
#include <QGlobalStatic>
#include "../exception/vexception.h" #include "../exception/vexception.h"
#include "../vmisc/def.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::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VVSTConverter::MeasurementMaxVer; // <== 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) VVSTConverter::VVSTConverter(const QString &fileName)
@ -143,7 +147,7 @@ bool VVSTConverter::IsReadOnly() const
// For now position is the same for all supported format versions. // 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 // 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} // \p{Zs} - \p{Space_Separator}
regex = QString("^([^\\p{Nd}\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;'\"]){1,1}" regex = QString("^([^\\p{Nd}\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;'\"]){1,1}"
"([^\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;\"]){0,}$") "([^\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;\"]){0,}$")
.arg(negativeSigns).arg(positiveSigns).arg(decimalPoints).arg(groupSeparators); .arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators);
} }
return regex; return regex;

View File

@ -41,6 +41,7 @@
#include <QStringData> #include <QStringData>
#include <QStringDataPtr> #include <QStringDataPtr>
#include <QtDebug> #include <QtDebug>
#include <QGlobalStatic>
#include "../ifc/exception/vexceptionemptyparameter.h" #include "../ifc/exception/vexceptionemptyparameter.h"
#include "../ifc/xml/vvitconverter.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::GenderFemale = QStringLiteral("female");
const QString VMeasurements::GenderUnknown = QStringLiteral("unknown"); const QString VMeasurements::GenderUnknown = QStringLiteral("unknown");
const QString defBirthDate = QStringLiteral("1800-01-01");
namespace namespace
{ {
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01")))
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString FileComment() QString FileComment()
{ {
@ -400,7 +401,7 @@ void VMeasurements::SetCustomer(const QString &text)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QDate VMeasurements::BirthDate() const 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)); personal.appendChild(createElement(TagCustomer));
QDomElement date = createElement(TagBirthDate); QDomElement date = createElement(TagBirthDate);
date.appendChild(createTextNode(defBirthDate)); date.appendChild(createTextNode(*defBirthDate));
personal.appendChild(date); personal.appendChild(date);
QDomElement gender = createElement(TagGender); 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 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) if (GetDuplicate() > 0)
{ {
name += QString("_%1").arg(GetDuplicate()); name += QString("_%1").arg(GetDuplicate());
@ -173,7 +173,7 @@ qreal VAbstractCubicBezier::GetParmT(qreal length) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractCubicBezier::CreateName() 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) if (GetDuplicate() > 0)
{ {
name += QString("_%1").arg(GetDuplicate()); name += QString("_%1").arg(GetDuplicate());

View File

@ -277,7 +277,11 @@ QVector<QPointF> VEllipticalArc::GetPoints() const
const QList<QPolygonF> sub = path.toSubpathPolygons(); const QList<QPolygonF> sub = path.toSubpathPolygons();
if (not sub.isEmpty()) 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()) if (not polygon.isEmpty())
{ {
polygon.removeFirst(); // remove point (0;0) polygon.removeFirst(); // remove point (0;0)

View File

@ -328,7 +328,11 @@ qreal VSplinePath::GetStartAngle() const
{ {
if (CountPoints() > 0) 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 else
{ {
@ -341,7 +345,11 @@ qreal VSplinePath::GetEndAngle() const
{ {
if (CountPoints() > 0) 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 else
{ {
@ -354,7 +362,11 @@ qreal VSplinePath::GetC1Length() const
{ {
if (CountPoints() > 0) 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 else
{ {
@ -367,7 +379,11 @@ qreal VSplinePath::GetC2Length() const
{ {
if (CountPoints() > 0) 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 else
{ {
@ -380,7 +396,11 @@ VPointF VSplinePath::FirstPoint() const
{ {
if (not d->path.isEmpty()) 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 else
{ {

View File

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

View File

@ -35,4 +35,13 @@
#define PRINTDPI 96.0 #define PRINTDPI 96.0
extern const qreal PrintDPI; 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 #endif // DEFGLOBAL_H

View File

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

View File

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

View File

@ -39,6 +39,7 @@
#include <QVariant> #include <QVariant>
#include <QPrinterInfo> #include <QPrinterInfo>
#include <QtDebug> #include <QtDebug>
#include <QGlobalStatic>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
@ -47,36 +48,37 @@ Q_DECLARE_METATYPE(QMarginsF)
namespace 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"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern")))
const QString settingPathsLayout = QStringLiteral("paths/layout"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout")))
const QString settingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
const QString settingPatternUseOpenGLRender = QStringLiteral("pattern/useOpenGLRender"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender")))
const QString settingPatternKnownMaterials = QStringLiteral("pattern/knownMaterials"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
const QString settingPatternRememberMaterials = QStringLiteral("pattern/rememberMaterials"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
const QString settingLayoutWidth = QStringLiteral("layout/width"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width")))
const QString settingLayoutSorting = QStringLiteral("layout/sorting"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting")))
const QString settingLayoutPaperHeight = QStringLiteral("layout/paperHeight"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight")))
const QString settingLayoutPaperWidth = QStringLiteral("layout/paperWidth"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth")))
const QString settingLayoutShift = QStringLiteral("layout/shift"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShift, (QLatin1String("layout/shift")))
const QString settingLayoutRotate = QStringLiteral("layout/Rotate"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutRotate, (QLatin1String("layout/Rotate")))
const QString settingLayoutRotationIncrease = QStringLiteral("layout/rotationIncrease"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutRotationIncrease, (QLatin1String("layout/rotationIncrease")))
const QString settingLayoutAutoCrop = QStringLiteral("layout/autoCrop"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCrop, (QLatin1String("layout/autoCrop")))
const QString settingLayoutSaveLength = QStringLiteral("layout/saveLength"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength")))
const QString settingLayoutUnitePages = QStringLiteral("layout/unitePages"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages")))
const QString settingFields = QStringLiteral("layout/fields"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields")))
const QString settingIgnoreFields = QStringLiteral("layout/ignoreFields"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields")))
const QString settingStripOptimization = QStringLiteral("layout/stripOptimization"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization")))
const QString settingMultiplier = QStringLiteral("layout/multiplier"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, (QLatin1String("layout/multiplier")))
const QString settingTextAsPaths = QStringLiteral("layout/textAsPaths"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, (QLatin1String("layout/textAsPaths")))
const QString settingTiledPDFMargins = QStringLiteral("tiledPDF/margins"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String("tiledPDF/margins")))
const QString settingTiledPDFPaperHeight = QStringLiteral("tiledPDF/paperHeight"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight")))
const QString settingTiledPDFPaperWidth = QStringLiteral("tiledPDF/paperWidth"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth")))
const QString settingTiledPDFOrientation = QStringLiteral("tiledPDF/orientation"); 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 QString VSettings::GetLabelLanguage() const
{ {
return value(settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString(); return value(*settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLabelLanguage(const QString &value) void VSettings::SetLabelLanguage(const QString &value)
{ {
setValue(settingConfigurationLabelLanguage, value); setValue(*settingConfigurationLabelLanguage, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -109,14 +111,14 @@ QString VSettings::GetDefPathPattern()
QString VSettings::GetPathPattern() const QString VSettings::GetPathPattern() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); 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) void VSettings::SetPathPattern(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
settings.setValue(settingPathsPattern, value); settings.setValue(*settingPathsPattern, value);
settings.sync(); settings.sync();
} }
@ -130,39 +132,39 @@ QString VSettings::GetDefPathLayout()
QString VSettings::GetPathLayout() const QString VSettings::GetPathLayout() const
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); 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) void VSettings::SetPathLayout(const QString &value)
{ {
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
settings.setValue(settingPathsLayout, value); settings.setValue(*settingPathsLayout, value);
settings.sync(); settings.sync();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetGraphicalOutput() const bool VSettings::GetGraphicalOutput() const
{ {
return value(settingPatternGraphicalOutput, 1).toBool(); return value(*settingPatternGraphicalOutput, 1).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetGraphicalOutput(const bool &value) void VSettings::SetGraphicalOutput(const bool &value)
{ {
setValue(settingPatternGraphicalOutput, value); setValue(*settingPatternGraphicalOutput, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::IsOpenGLRender() const bool VSettings::IsOpenGLRender() const
{ {
return value(settingPatternUseOpenGLRender, 0).toBool(); return value(*settingPatternUseOpenGLRender, 0).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetOpenGLRender(bool value) 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); const qreal def = UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px);
bool ok = false; bool ok = false;
const qreal height = value(settingLayoutPaperHeight, def).toDouble(&ok); const qreal height = value(*settingLayoutPaperHeight, def).toDouble(&ok);
if (ok) if (ok)
{ {
return height; return height;
@ -184,7 +186,7 @@ qreal VSettings::GetLayoutPaperHeight() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutPaperHeight(qreal value) 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); const qreal def = UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px);
bool ok = false; bool ok = false;
const qreal width = value(settingLayoutPaperWidth, def).toDouble(&ok); const qreal width = value(*settingLayoutPaperWidth, def).toDouble(&ok);
if (ok) if (ok)
{ {
return width; return width;
@ -206,7 +208,7 @@ qreal VSettings::GetLayoutPaperWidth() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutPaperWidth(qreal value) void VSettings::SetLayoutPaperWidth(qreal value)
{ {
setValue(settingLayoutPaperWidth, value); setValue(*settingLayoutPaperWidth, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -214,7 +216,7 @@ qreal VSettings::GetLayoutShift() const
{ {
const qreal def = GetDefLayoutShift(); const qreal def = GetDefLayoutShift();
bool ok = false; bool ok = false;
const qreal shift = value(settingLayoutShift, def).toDouble(&ok); const qreal shift = value(*settingLayoutShift, def).toDouble(&ok);
if (ok) if (ok)
{ {
return shift; return shift;
@ -234,7 +236,7 @@ qreal VSettings::GetDefLayoutShift()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutShift(qreal value) void VSettings::SetLayoutShift(qreal value)
{ {
setValue(settingLayoutShift, value); setValue(*settingLayoutShift, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -242,7 +244,7 @@ qreal VSettings::GetLayoutWidth() const
{ {
const qreal def = GetDefLayoutWidth(); const qreal def = GetDefLayoutWidth();
bool ok = false; bool ok = false;
const qreal lWidth = value(settingLayoutWidth, def).toDouble(&ok); const qreal lWidth = value(*settingLayoutWidth, def).toDouble(&ok);
if (ok) if (ok)
{ {
return lWidth; return lWidth;
@ -262,13 +264,13 @@ qreal VSettings::GetDefLayoutWidth()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutWidth(qreal value) void VSettings::SetLayoutWidth(qreal value)
{ {
setValue(settingLayoutWidth, value); setValue(*settingLayoutWidth, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMarginsF VSettings::GetFields(const QMarginsF &def) const 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>()) if (val.canConvert<QMarginsF>())
{ {
return val.value<QMarginsF>(); return val.value<QMarginsF>();
@ -279,7 +281,7 @@ QMarginsF VSettings::GetFields(const QMarginsF &def) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetFields(const QMarginsF &value) 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(); const Cases def = GetDefLayoutGroup();
bool ok = false; 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 (ok)
{ {
if (g >= static_cast<int>(Cases::UnknownCase)) if (g >= static_cast<int>(Cases::UnknownCase))
@ -314,13 +316,13 @@ Cases VSettings::GetDefLayoutGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutGroup(const Cases &value) void VSettings::SetLayoutGroup(const Cases &value)
{ {
setValue(settingLayoutSorting, static_cast<int>(value)); setValue(*settingLayoutSorting, static_cast<int>(value));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutRotate() const 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) void VSettings::SetLayoutRotate(bool value)
{ {
setValue(settingLayoutRotate, value); setValue(*settingLayoutRotate, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -340,7 +342,7 @@ int VSettings::GetLayoutRotationIncrease() const
{ {
const int def = GetDefLayoutRotationIncrease(); const int def = GetDefLayoutRotationIncrease();
bool ok = false; bool ok = false;
const int r = value(settingLayoutRotationIncrease, def).toInt(&ok); const int r = value(*settingLayoutRotationIncrease, def).toInt(&ok);
if (ok) if (ok)
{ {
if (not (r >= 1 && r <= 180 && 360 % r == 0)) if (not (r >= 1 && r <= 180 && 360 % r == 0))
@ -367,13 +369,13 @@ int VSettings::GetDefLayoutRotationIncrease()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutRotationIncrease(int value) void VSettings::SetLayoutRotationIncrease(int value)
{ {
setValue(settingLayoutRotationIncrease, value); setValue(*settingLayoutRotationIncrease, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutAutoCrop() const 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) void VSettings::SetLayoutAutoCrop(bool value)
{ {
setValue(settingLayoutAutoCrop, value); setValue(*settingLayoutAutoCrop, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutSaveLength() const 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) void VSettings::SetLayoutSaveLength(bool value)
{ {
setValue(settingLayoutSaveLength, value); setValue(*settingLayoutSaveLength, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutUnitePages() const 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) void VSettings::SetLayoutUnitePages(bool value)
{ {
setValue(settingLayoutUnitePages, value); setValue(*settingLayoutUnitePages, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetIgnoreAllFields() const 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) void VSettings::SetIgnoreAllFields(bool value)
{ {
setValue(settingIgnoreFields, value); setValue(*settingIgnoreFields, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetStripOptimization() const 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) void VSettings::SetStripOptimization(bool value)
{ {
setValue(settingStripOptimization, value); setValue(*settingStripOptimization, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint8 VSettings::GetMultiplier() const 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) void VSettings::SetMultiplier(quint8 value)
{ {
setValue(settingMultiplier, value); setValue(*settingMultiplier, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetTextAsPaths() const 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) void VSettings::SetTextAsPaths(bool value)
{ {
setValue(settingTextAsPaths, value); setValue(*settingTextAsPaths, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VSettings::GetKnownMaterials() const QStringList VSettings::GetKnownMaterials() const
{ {
return value(settingPatternKnownMaterials, QStringList()).toStringList(); return value(*settingPatternKnownMaterials, QStringList()).toStringList();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetKnownMaterials(const QStringList &list) void VSettings::SetKnownMaterials(const QStringList &list)
{ {
setValue(settingPatternKnownMaterials, list); setValue(*settingPatternKnownMaterials, list);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::IsRememberPatternMaterials() const bool VSettings::IsRememberPatternMaterials() const
{ {
return value(settingPatternRememberMaterials, true).toBool(); return value(*settingPatternRememberMaterials, true).toBool();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetRememberPatternMaterials(bool value) void VSettings::SetRememberPatternMaterials(bool value)
{ {
setValue(settingPatternRememberMaterials, value); setValue(*settingPatternRememberMaterials, value);
} }
// settings for the tiled PDFs // 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. // default value is 10mm. We save the margins in mm in the setting.
const QMarginsF def = QMarginsF(10, 10, 10, 10); 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>()) if (val.canConvert<QMarginsF>())
{ {
@ -552,7 +554,7 @@ QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const
*/ */
void VSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &unit) 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*/; const qreal def = 297 /*A4*/;
bool ok = false; bool ok = false;
const qreal height = value(settingTiledPDFPaperHeight, def).toDouble(&ok); const qreal height = value(*settingTiledPDFPaperHeight, def).toDouble(&ok);
if (ok) if (ok)
{ {
return UnitConvertor(height, Unit::Mm, unit); 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) 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*/; const qreal def = 210 /*A4*/;
bool ok = false; bool ok = false;
const qreal width = value(settingTiledPDFPaperWidth, def).toDouble(&ok); const qreal width = value(*settingTiledPDFPaperWidth, def).toDouble(&ok);
if (ok) if (ok)
{ {
return UnitConvertor(width, Unit::Mm, unit); 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) 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 PageOrientation VSettings::GetTiledPDFOrientation() const
{ {
bool defaultValue = static_cast<bool>(PageOrientation::Portrait); bool defaultValue = static_cast<bool>(PageOrientation::Portrait);
bool result = value(settingTiledPDFOrientation, defaultValue).toBool(); bool result = value(*settingTiledPDFOrientation, defaultValue).toBool();
return static_cast<PageOrientation>(result); return static_cast<PageOrientation>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSettings::SetTiledPDFOrientation(PageOrientation value) 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 <QStringData>
#include <QStringDataPtr> #include <QStringDataPtr>
#include <QVariant> #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"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefHeight, (QLatin1String("gradation/defHeight")))
const QString settingDefSize = QStringLiteral("gradation/defSize"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefSize, (QLatin1String("gradation/defSize")))
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application, 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 QByteArray VTapeSettings::GetDataBaseGeometry() const
{ {
return value(settingDataBaseGeometry).toByteArray(); return value(*settingDataBaseGeometry).toByteArray();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDataBaseGeometry(const QByteArray &value) void VTapeSettings::SetDataBaseGeometry(const QByteArray &value)
{ {
setValue(settingDataBaseGeometry, value); setValue(*settingDataBaseGeometry, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDefHeight(int value) void VTapeSettings::SetDefHeight(int value)
{ {
setValue(settingDefHeight, value); setValue(*settingDefHeight, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetDefHeight() const int VTapeSettings::GetDefHeight() const
{ {
return value(settingDefHeight, 176).toInt(); return value(*settingDefHeight, 176).toInt();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTapeSettings::SetDefSize(int value) void VTapeSettings::SetDefSize(int value)
{ {
setValue(settingDefSize, value); setValue(*settingDefSize, value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VTapeSettings::GetDefSize() const 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(); QList<QUrl> tmpUrlList = data->urls();
QFileInfo tmpFileInfo; QFileInfo tmpFileInfo;
foreach(QUrl tmpUrl, tmpUrlList) for(const QUrl &tmpUrl : tmpUrlList)
{
if (QFile::exists(tmpUrl.toLocalFile())) if (QFile::exists(tmpUrl.toLocalFile()))
{ {
tmpFileInfo = QFileInfo(tmpUrl.toLocalFile()); break; tmpFileInfo = QFileInfo(tmpUrl.toLocalFile()); break;
} }
}
if (checkFileFilter(tmpFileInfo.fileName())) if (checkFileFilter(tmpFileInfo.fileName()))
{ {

View File

@ -319,12 +319,12 @@ VPE::VPropertySet *VPE::VPropertyModel::takePropertySet(VPropertySet *new_proper
if (emit_signals) if (emit_signals)
{ {
emit beginResetModel(); beginResetModel();
} }
d_ptr->Properties = new_property_set; d_ptr->Properties = new_property_set;
if (emit_signals) if (emit_signals)
{ {
emit endResetModel(); endResetModel();
} }
return tmpOldPropertySet; 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) 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); QFileInfo info(program);
if (not info.exists()) if (not info.exists())
@ -134,7 +134,7 @@ int AbstractTest::Run(int exit, const QString &program, const QStringList &argum
if (process->exitStatus() == QProcess::CrashExit) 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; return TST_EX_CRASH;
} }
@ -177,7 +177,7 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
} }
else else
{ {
if (QFileInfo(tgtFilePath).exists()) if (QFileInfo::exists(tgtFilePath))
{ {
const QString msg = QString("File '%1' exists.").arg(srcFilePath); const QString msg = QString("File '%1' exists.").arg(srcFilePath);
QWARN(qUtf8Printable(msg)); QWARN(qUtf8Printable(msg));
@ -197,7 +197,7 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
QFile srcFile(srcFilePath); QFile srcFile(srcFilePath);
if (not srcFile.open(QFile::ReadOnly)) 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)); QWARN(qUtf8Printable(msg));
return false; return false;
} }
@ -205,8 +205,8 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
if (not srcFile.copy(tgtFilePath)) if (not srcFile.copy(tgtFilePath))
{ {
const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3").arg(srcFilePath).arg(tgtFilePath) const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3")
.arg(srcFile.errorString()); .arg(srcFilePath, tgtFilePath, srcFile.errorString());
QWARN(qUtf8Printable(msg)); QWARN(qUtf8Printable(msg));
return false; return false;
} }

View File

@ -134,14 +134,14 @@ void DialogEditWrongFormula::DialogAccepted()
{ {
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
accepted(); emit accepted();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DialogRejected() void DialogEditWrongFormula::DialogRejected()
{ {
emit DialogClosed(QDialog::Rejected); 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, void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, const QString &unit,
const QString &description) 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); ui->labelDescription->setText(desc);
} }
@ -592,8 +592,9 @@ void DialogEditWrongFormula::ShowFunctions()
ui->tableWidget->setColumnHidden(ColumnFullName, true); ui->tableWidget->setColumnHidden(ColumnFullName, true);
ui->labelDescription->setText(""); ui->labelDescription->setText("");
QMap<QString, qmu::QmuTranslation>::const_iterator i = qApp->TrVars()->GetFunctions().constBegin(); const QMap<QString, qmu::QmuTranslation> functions = qApp->TrVars()->GetFunctions();
while (i != qApp->TrVars()->GetFunctions().constEnd()) QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
while (i != functions.constEnd())
{ {
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1); ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
QTableWidgetItem *item = new QTableWidgetItem(i.value().translate(qApp->Settings()->GetLocale())); 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 // 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 filter is empty findItems() for unknown reason returns nullptr items.
if (item) if (item)

View File

@ -843,8 +843,7 @@ void DialogPiecePath::InitPathTab()
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogPiecePath::NameChanged); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogPiecePath::NameChanged);
InitPathTypes(); InitPathTypes();
connect(ui->comboBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
[this]()
{ {
ui->comboBoxPenType->setEnabled(GetType() == PiecePathType::InternalPath); ui->comboBoxPenType->setEnabled(GetType() == PiecePathType::InternalPath);
ui->checkBoxCut->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 QString VToolFlippingByAxis::MakeToolTip() const
{ {
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>") const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>")
.arg(tr("Origin point")) .arg(tr("Origin point"), OriginPointName());
.arg(OriginPointName());
return toolTip; return toolTip;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -92,7 +92,7 @@ void AddGroup::undo()
} }
VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView()); 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(); emit NeedFullParsing();
VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView()); 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) if (redoFlag)
{ {
emit NeedFullParsing(); emit NeedFullParsing();
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
} }
else else
{ {

View File

@ -58,7 +58,7 @@ void DelGroup::undo()
{ {
qCDebug(vUndo, "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(); QDomElement groups = doc->CreateGroups();
if (not groups.isNull()) if (not groups.isNull())
@ -82,7 +82,7 @@ void DelGroup::redo()
qCDebug(vUndo, "Redo."); qCDebug(vUndo, "Redo.");
//Keep first! //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(); QDomElement groups = doc->CreateGroups();
if (not groups.isNull()) if (not groups.isNull())
{ {

View File

@ -59,7 +59,7 @@ void DelTool::undo()
UndoDeleteAfterSibling(parentNode, siblingId); UndoDeleteAfterSibling(parentNode, siblingId);
emit NeedFullParsing(); emit NeedFullParsing();
//Keep last! //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."); qCDebug(vUndo, "Redo.");
//Keep first! //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); QDomElement domElement = doc->NodeById(nodeId);
parentNode.removeChild(domElement); parentNode.removeChild(domElement);
emit NeedFullParsing(); emit NeedFullParsing();

View File

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

View File

@ -83,8 +83,7 @@ void VisToolEndLine::RefreshGeometry()
"<b>Shift</b> - sticking angle, <b>Enter</b> - finish creation") "<b>Shift</b> - sticking angle, <b>Enter</b> - finish creation")
.arg(this->line().angle()) .arg(this->line().angle())
.arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length())), .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length())),
qApp->Settings()->GetOsSeparator())) qApp->Settings()->GetOsSeparator()), prefix);
.arg(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. " 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 " "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. " "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.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setDefaultButton(QDialogButtonBox::No);
msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32)); msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32));

View File

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

View File

@ -31,9 +31,13 @@
#include "../vmisc/logging.h" #include "../vmisc/logging.h"
#include <QtTest> #include <QtTest>
#include <QGlobalStatic>
const QString tmpTestFolder = QStringLiteral("tst_valentina_tmp"); namespace
const QString tmpTestCollectionFolder = QStringLiteral("tst_valentina_collection_tmp"); {
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) TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
:AbstractTest(parent) :AbstractTest(parent)
@ -45,7 +49,7 @@ TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
void TST_ValentinaCommandLine::initTestCase() void TST_ValentinaCommandLine::initTestCase()
{ {
{// Test files {// Test files
QDir tmpDir(tmpTestFolder); QDir tmpDir(*tmpTestFolder);
if (not tmpDir.removeRecursively()) if (not tmpDir.removeRecursively())
{ {
QFAIL("Fail to remove test temp directory."); QFAIL("Fail to remove test temp directory.");
@ -53,14 +57,14 @@ void TST_ValentinaCommandLine::initTestCase()
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() +
QLatin1String("tst_valentina"), QLatin1String("tst_valentina"),
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder)) QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder))
{ {
QFAIL("Fail to prepare test files for testing."); QFAIL("Fail to prepare test files for testing.");
} }
} }
{// Collection {// Collection
QDir tmpDir(tmpTestCollectionFolder); QDir tmpDir(*tmpTestCollectionFolder);
if (not tmpDir.removeRecursively()) if (not tmpDir.removeRecursively())
{ {
QFAIL("Fail to remove collection temp directory."); QFAIL("Fail to remove collection temp directory.");
@ -68,7 +72,7 @@ void TST_ValentinaCommandLine::initTestCase()
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() +
QLatin1String("tst_valentina_collection"), QLatin1String("tst_valentina_collection"),
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder)) QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder))
{ {
QFAIL("Fail to prepare collection files for testing."); QFAIL("Fail to prepare collection files for testing.");
} }
@ -104,7 +108,7 @@ void TST_ValentinaCommandLine::OpenPatterns()
QFETCH(int, exitCode); QFETCH(int, exitCode);
QString error; 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" const int exit = Run(exitCode, ValentinaPath(), QStringList() << "--test"
<< tmp + QDir::separator() + file, error); << tmp + QDir::separator() + file, error);
@ -119,7 +123,7 @@ void TST_ValentinaCommandLine::ExportMode_data() const
QTest::addColumn<QString>("arguments"); QTest::addColumn<QString>("arguments");
QTest::addColumn<int>("exitCode"); 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" QTest::newRow("Issue #372")<< "issue_372.val"
<< QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp) << QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp)
@ -155,7 +159,7 @@ void TST_ValentinaCommandLine::ExportMode()
QFETCH(int, exitCode); QFETCH(int, exitCode);
QString error; 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 const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;"); << arguments.split(";;");
const int exit = Run(exitCode, ValentinaPath(), arg, error); const int exit = Run(exitCode, ValentinaPath(), arg, error);
@ -170,7 +174,7 @@ void TST_ValentinaCommandLine::TestMode_data() const
QTest::addColumn<QString>("arguments"); QTest::addColumn<QString>("arguments");
QTest::addColumn<int>("exitCode"); 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" QTest::newRow("Issue #256. Correct path.")<< "issue_256.val"
<< QString("--test") << QString("--test")
@ -213,7 +217,7 @@ void TST_ValentinaCommandLine::TestMode()
QFETCH(int, exitCode); QFETCH(int, exitCode);
QString error; 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 const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;"); << arguments.split(";;");
const int exit = Run(exitCode, ValentinaPath(), arg, error); const int exit = Run(exitCode, ValentinaPath(), arg, error);
@ -228,7 +232,7 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const
QTest::addColumn<QString>("arguments"); QTest::addColumn<QString>("arguments");
QTest::addColumn<int>("exitCode"); 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 testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst"));
const QString keyTest = QStringLiteral("--test"); const QString keyTest = QStringLiteral("--test");
@ -274,7 +278,7 @@ void TST_ValentinaCommandLine::TestOpenCollection()
QFETCH(int, exitCode); QFETCH(int, exitCode);
QString error; 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 const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;"); << arguments.split(";;");
const int exit = Run(exitCode, ValentinaPath(), arg, error); const int exit = Run(exitCode, ValentinaPath(), arg, error);
@ -287,7 +291,7 @@ void TST_ValentinaCommandLine::TestOpenCollection()
void TST_ValentinaCommandLine::cleanupTestCase() void TST_ValentinaCommandLine::cleanupTestCase()
{ {
{ {
QDir tmpDir(tmpTestFolder); QDir tmpDir(*tmpTestFolder);
if (not tmpDir.removeRecursively()) if (not tmpDir.removeRecursively())
{ {
QWARN("Fail to remove test temp directory."); 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()) if (not tmpDir.removeRecursively())
{ {
QWARN("Fail to remove collection temp directory."); 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) if (QFileInfo(path+QLatin1String("/")+file).size() <= 34)
{ {
const QString message = QString("Translation variables for locale = %1 is empty. \nFull path: %2/%3") const QString message = QString("Translation variables for locale = %1 is empty. \nFull path: %2/%3")
.arg(checkedLocale) .arg(checkedLocale, path, file);
.arg(path)
.arg(file);
QWARN(qUtf8Printable(message)); QWARN(qUtf8Printable(message));
return ErrorSize; return ErrorSize;
@ -74,9 +72,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale)
if (not m_vTranslator->load(file, path)) if (not m_vTranslator->load(file, path))
{ {
const QString message = QString("Can't load translation variables for locale = %1. \nFull path: %2/%3") const QString message = QString("Can't load translation variables for locale = %1. \nFull path: %2/%3")
.arg(checkedLocale) .arg(checkedLocale, path, file);
.arg(path)
.arg(file);
QWARN(qUtf8Printable(message)); QWARN(qUtf8Printable(message));
delete m_vTranslator; delete m_vTranslator;
@ -87,9 +83,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale)
if (not QCoreApplication::installTranslator(m_vTranslator)) if (not QCoreApplication::installTranslator(m_vTranslator))
{ {
const QString message = QString("Can't install translation variables for locale = %1. \nFull path: %2/%3") const QString message = QString("Can't install translation variables for locale = %1. \nFull path: %2/%3")
.arg(checkedLocale) .arg(checkedLocale, path, file);
.arg(path)
.arg(file);
QWARN(qUtf8Printable(message)); QWARN(qUtf8Printable(message));
delete m_vTranslator; delete m_vTranslator;
@ -153,7 +147,7 @@ void TST_AbstractRegExp::CallTestCheckRegExpNames()
const QString translated = m_trMs->VarToUser(originalName); const QString translated = m_trMs->VarToUser(originalName);
if (not re.match(translated).hasMatch()) 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)); QFAIL(qUtf8Printable(message));
} }
} }
@ -169,7 +163,7 @@ void TST_AbstractRegExp::CallTestCheckIsNamesUnique()
if (names.contains(translated)) if (names.contains(translated))
{ {
const QString message = QString("Name is not unique. Original name:'%1', translated name:'%2'") const QString message = QString("Name is not unique. Original name:'%1', translated name:'%2'")
.arg(originalName).arg(translated); .arg(originalName, translated);
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
names.insert(translated); names.insert(translated);
@ -190,7 +184,7 @@ void TST_AbstractRegExp::CallTestCheckNoOriginalNamesInTranslation()
{ {
const QString message = QString("Translation repeat original name from other place. " const QString message = QString("Translation repeat original name from other place. "
"Original name:'%1', translated name:'%2'") "Original name:'%1', translated name:'%2'")
.arg(originalName).arg(translated); .arg(originalName, translated);
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
} }

View File

@ -52,17 +52,17 @@ TST_AbstractTranslation::TST_AbstractTranslation(QObject *parent)
QDomNodeList TST_AbstractTranslation::LoadTSFile(const QString &filename) QDomNodeList TST_AbstractTranslation::LoadTSFile(const QString &filename)
{ {
tsFile.reset(); 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()) 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)); QWARN(qUtf8Printable(message));
return QDomNodeList(); return QDomNodeList();
} }
if (tsFile->open(QIODevice::ReadOnly) == false) 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)); QWARN(qUtf8Printable(message));
return QDomNodeList(); return QDomNodeList();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -115,19 +115,19 @@ void TST_QmuTokenParser::PrepareVal(qreal val, const QLocale &locale)
{ {
const QString formula = locale.toString(val); const QString formula = locale.toString(val);
QString string = formula; 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; QTest::newRow(qUtf8Printable(tag)) << string << true << locale;
string = formula+QLatin1String("+"); 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; QTest::newRow(qUtf8Printable(tag)) << string << false << locale;
string = formula+QLatin1String("+")+formula; 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; QTest::newRow(qUtf8Printable(tag)) << string << false << locale;
string = formula+QString("+б"); 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; 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) 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; QTest::newRow(qUtf8Printable(tag)) << str << count << val << locale;
} }

View File

@ -49,8 +49,8 @@ void TST_VLockGuard::TryLock() const
VlpCreateLock(lock, fileName); VlpCreateLock(lock, fileName);
fileName = lock->GetLockFile(); fileName = lock->GetLockFile();
QVERIFY2(QFileInfo(fileName).exists(), "Lock file doesn't exist!"); QVERIFY2(QFileInfo::exists(fileName), "Lock file doesn't exist!");
lock.reset(); 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; QString error;
const bool result = m->SaveDocument(fileName, 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)); QVERIFY2(result, qUtf8Printable(message));
} }
else else
@ -180,7 +180,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile()
} }
catch (VException &e) 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)); QFAIL(qUtf8Printable(message));
} }
} }
@ -217,7 +217,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile()
QString error; QString error;
const bool result = m->SaveDocument(fileName, 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)); QVERIFY2(result, qUtf8Printable(message));
} }
else else
@ -231,7 +231,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile()
} }
catch (VException &e) 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)); 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) 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; QTest::newRow(qUtf8Printable(tag)) << inputString << outputString << locale;
}; };