diff --git a/common.pri b/common.pri index b05b355d2..9f4826b7c 100644 --- a/common.pri +++ b/common.pri @@ -147,28 +147,33 @@ defineReplace(set_PCH){ } defineReplace(enable_ccache){ - no_ccache{ # For enable run qmake with CONFIG+=no_ccache - $$set_PCH() + *clang*:clazy { + QMAKE_CXX = clazy + export(QMAKE_CXX) # export value to global variable. } else { - # ccache support only Unix systems. - unix:{ - # This need for turn on ccache. - *g++*{ - QMAKE_CC = ccache gcc - export(QMAKE_CC) # export value to global variable. - - QMAKE_CXX = ccache g++ - export(QMAKE_CXX) # export value to global variable. - } - *clang*{ - QMAKE_CC = ccache clang - export(QMAKE_CC) # export value to global variable. - - QMAKE_CXX = ccache clang++ - export(QMAKE_CXX) # export value to global variable. - } - } else { + no_ccache{ # For enable run qmake with CONFIG+=no_ccache $$set_PCH() + } else { + # ccache support only Unix systems. + unix:{ + # This need for turn on ccache. + *g++*{ + QMAKE_CC = ccache gcc + export(QMAKE_CC) # export value to global variable. + + QMAKE_CXX = ccache g++ + export(QMAKE_CXX) # export value to global variable. + } + *clang*{ + QMAKE_CC = ccache clang + export(QMAKE_CC) # export value to global variable. + + QMAKE_CXX = ccache clang++ + export(QMAKE_CXX) # export value to global variable. + } + } else { + $$set_PCH() + } } } return(true) diff --git a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp index 494d3f56f..9377303f8 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp @@ -75,7 +75,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare } //----------------------------- Measurements Editing - connect(ui->resetWarningsButton, &QPushButton::released, []() + connect(ui->resetWarningsButton, &QPushButton::released, this, []() { VTapeSettings *settings = qApp->TapeSettings(); diff --git a/src/app/tape/dialogs/dialogabouttape.cpp b/src/app/tape/dialogs/dialogabouttape.cpp index d5250c218..a7c177ca2 100644 --- a/src/app/tape/dialogs/dialogabouttape.cpp +++ b/src/app/tape/dialogs/dialogabouttape.cpp @@ -130,7 +130,7 @@ void DialogAboutTape::RetranslateUi() ui->label_QT_Version->setText(buildCompatibilityString()); const QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); - ui->label_Tape_Built->setText(tr("Built on %1 at %2").arg(date.toString()).arg(__TIME__)); + ui->label_Tape_Built->setText(tr("Built on %1 at %2").arg(date.toString(), __TIME__)); ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings", "The program is provided AS IS with NO WARRANTY OF ANY " diff --git a/src/app/tape/dialogs/dialogmdatabase.cpp b/src/app/tape/dialogs/dialogmdatabase.cpp index c6f591b0a..f6452facd 100644 --- a/src/app/tape/dialogs/dialogmdatabase.cpp +++ b/src/app/tape/dialogs/dialogmdatabase.cpp @@ -182,7 +182,7 @@ QString DialogMDataBase::ImgTag(const QString &number) { QString imgUrl(""); // In case of error const QString filePath = QString("://diagrams/%1.svg").arg(MapDiagrams(qApp->TrVars(), number)); - if (QFileInfo(filePath).exists()) + if (QFileInfo::exists(filePath)) { // Load your SVG QSvgRenderer renderer; @@ -552,10 +552,7 @@ QString DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showIma "normal\"> %1
%2. %3

" "

%4

") - .arg(imgTag) - .arg(number) - .arg(qApp->TrVars()->GuiText(name)) - .arg(qApp->TrVars()->Description(name)); + .arg(imgTag, number, qApp->TrVars()->GuiText(name), qApp->TrVars()->Description(name)); return text; } diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp index 03f8781c6..ce17a51db 100644 --- a/src/app/tape/main.cpp +++ b/src/app/tape/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(schema); Q_INIT_RESOURCE(flags); - QT_REQUIRE_VERSION(argc, argv, "5.2.0") + QT_REQUIRE_VERSION(argc, argv, "5.2.0")// clazy:exclude=qstring-arg #if defined(Q_OS_WIN) VAbstractApplication::WinAttachConsole(); diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 037f57503..037d31d1a 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -215,7 +215,7 @@ bool TMainWindow::LoadFile(const QString &path) { if (m == nullptr) { - if (not QFileInfo(path).exists()) + if (not QFileInfo::exists(path)) { qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path))); if (qApp->IsTestMode()) @@ -876,7 +876,7 @@ bool TMainWindow::FileSaveAs() fileName += QLatin1String(".") + suffix; } - if (QFileInfo(fileName).exists()) + if (QFileInfo::exists(fileName)) { // Temporary try to lock the file before saving VLockGuard tmp(fileName); @@ -1595,7 +1595,7 @@ void TMainWindow::ShowMDiagram(const QString &name) { ui->labelDiagram->setText(QString("

%1

" "

%2. %3

") - .arg(DialogMDataBase::ImgTag(number)).arg(number).arg(trv->GuiText(name))); + .arg(DialogMDataBase::ImgTag(number), number, trv->GuiText(name))); } // This part is very ugly, can't find better way to resize dockWidget. ui->labelDiagram->adjustSize(); @@ -2152,9 +2152,9 @@ void TMainWindow::InitWindow() connect(ui->comboBoxPMSystem, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::SavePMSystem); - connect(ui->lineEditFind, &QLineEdit::textChanged, [this] (const QString &term){search->Find(term);}); - connect(ui->toolButtonFindPrevious, &QToolButton::clicked, [this] (){search->FindPrevious();}); - connect(ui->toolButtonFindNext, &QToolButton::clicked, [this] (){search->FindNext();}); + connect(ui->lineEditFind, &QLineEdit::textChanged, this, [this] (const QString &term){search->Find(term);}); + connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this] (){search->FindPrevious();}); + connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this] (){search->FindNext();}); connect(search.data(), &VTableSearch::HasResult, this, [this] (bool state) { @@ -2243,7 +2243,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString { header.remove(index-1, 100); } - const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit); + const QString unitHeader = QString("%1 (%2)").arg(header, unit); table->horizontalHeaderItem(column)->setText(unitHeader); } @@ -2825,7 +2825,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path) { if (m == nullptr) { - if (not QFileInfo(path).exists()) + if (not QFileInfo::exists(path)) { qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path))); if (qApp->IsTestMode()) diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index de07523d1..cc78802b1 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -142,28 +142,28 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con { case QtDebugMsg: debugdate += QString(":DEBUG:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) - .arg(context.function).arg(context.category).arg(msg); + .arg(context.function, context.category, msg); vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << msg << "\n"; break; case QtWarningMsg: debugdate += QString(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) - .arg(context.function).arg(context.category).arg(msg); + .arg(context.function, context.category, msg); vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << msg << "\n"; break; case QtCriticalMsg: debugdate += QString(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) - .arg(context.function).arg(context.category).arg(msg); + .arg(context.function, context.category, msg); vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << msg << "\n"; break; case QtFatalMsg: debugdate += QString(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) - .arg(context.function).arg(context.category).arg(msg); + .arg(context.function, context.category, msg); vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << msg << "\n"; break; #if QT_VERSION > QT_VERSION_CHECK(5, 4, 2) case QtInfoMsg: debugdate += QString(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) - .arg(context.function).arg(context.category).arg(msg); + .arg(context.function, context.category, msg); vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << msg << "\n"; break; #endif @@ -306,7 +306,7 @@ void VApplication::NewValentina(const QString &fileName) } else { - const QString run = QString("\"%1\" \"%2\"").arg(QCoreApplication::applicationFilePath()).arg(fileName); + const QString run = QString("\"%1\" \"%2\"").arg(QCoreApplication::applicationFilePath(), fileName); qCDebug(vApp, "New process with arguments. program = %s", qUtf8Printable(run)); if (QProcess::startDetached(run)) { diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp index cc2765626..e244b7f92 100644 --- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp @@ -99,7 +99,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent) } //----------------------------- Pattern Editing - connect(ui->resetWarningsButton, &QPushButton::released, []() + connect(ui->resetWarningsButton, &QPushButton::released, this, []() { VSettings *settings = qApp->ValentinaSettings(); diff --git a/src/app/valentina/dialogs/dialogaboutapp.cpp b/src/app/valentina/dialogs/dialogaboutapp.cpp index 3ea792c8d..d5c323212 100644 --- a/src/app/valentina/dialogs/dialogaboutapp.cpp +++ b/src/app/valentina/dialogs/dialogaboutapp.cpp @@ -52,7 +52,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) : ui->label_QT_Version->setText(buildCompatibilityString()); QDate date = QLocale::c().toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); - ui->label_Valentina_Built->setText(tr("Built on %1 at %2").arg(date.toString()).arg(__TIME__)); + ui->label_Valentina_Built->setText(tr("Built on %1 at %2").arg(date.toString(), __TIME__)); ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings", "The program is provided AS IS with NO WARRANTY OF ANY " diff --git a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp index 59b73a33e..cf2dc41fe 100644 --- a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp +++ b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp @@ -551,14 +551,14 @@ void DialogFinalMeasurements::ShowUnits() { // calculated value const QString header = ui->tableWidget->horizontalHeaderItem(1)->text(); - const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit); + const QString unitHeader = QString("%1 (%2)").arg(header, unit); ui->tableWidget->horizontalHeaderItem(1)->setText(unitHeader); } { // formula const QString header = ui->tableWidget->horizontalHeaderItem(2)->text(); - const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit); + const QString unitHeader = QString("%1 (%2)").arg(header, unit); ui->tableWidget->horizontalHeaderItem(2)->setText(unitHeader); } } diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 3a767a7cf..d2ad7f409 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -239,37 +239,33 @@ QString DialogHistory::Record(const VToolRecord &tool) return tr("%1 - Base point").arg(PointName(tool.getId())); case Tool::EndLine: return tr("%1_%2 - Line from point %1 to point %2") - .arg(PointName(AttrUInt(domElem, AttrBasePoint))) - .arg(PointName(tool.getId())); + .arg(PointName(AttrUInt(domElem, AttrBasePoint)), PointName(tool.getId())); case Tool::Line: return tr("%1_%2 - Line from point %1 to point %2") - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))); + .arg(PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint))); case Tool::AlongLine: return tr("%3 - Point along line %1_%2") - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) - .arg(PointName(tool.getId())); + .arg(PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint)), PointName(tool.getId())); case Tool::ShoulderPoint: return tr("%1 - Point of shoulder").arg(PointName(tool.getId())); case Tool::Normal: return tr("%3 - normal to line %1_%2") - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) - .arg(PointName(tool.getId())); + .arg(PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint)), PointName(tool.getId())); case Tool::Bisector: return tr("%4 - bisector of angle %1_%2_%3") - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) - .arg(PointName(AttrUInt(domElem, AttrThirdPoint))) - .arg(PointName(tool.getId())); + .arg(PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint)), + PointName(AttrUInt(domElem, AttrThirdPoint)), PointName(tool.getId())); case Tool::LineIntersect: return tr("%5 - intersection of lines %1_%2 and %3_%4") - .arg(PointName(AttrUInt(domElem, AttrP1Line1))) - .arg(PointName(AttrUInt(domElem, AttrP2Line1))) - .arg(PointName(AttrUInt(domElem, AttrP1Line2))) - .arg(PointName(AttrUInt(domElem, AttrP2Line2))) - .arg(PointName(tool.getId())); + .arg(PointName(AttrUInt(domElem, AttrP1Line1)), + PointName(AttrUInt(domElem, AttrP2Line1)), + PointName(AttrUInt(domElem, AttrP1Line2)), + PointName(AttrUInt(domElem, AttrP2Line2)), + PointName(tool.getId())); case Tool::Spline: { const QSharedPointer spl = data->GeometricObject(tool.getId()); @@ -310,33 +306,32 @@ QString DialogHistory::Record(const VToolRecord &tool) } case Tool::PointOfContact: return tr("%4 - point of contact of arc with the center in point %1 and line %2_%3") - .arg(PointName(AttrUInt(domElem, AttrCenter))) - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) - .arg(PointName(tool.getId())); + .arg(PointName(AttrUInt(domElem, AttrCenter)), + PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint)), + PointName(tool.getId())); case Tool::Height: return tr("Point of perpendicular from point %1 to line %2_%3") - .arg(PointName(AttrUInt(domElem, AttrBasePoint))) - .arg(PointName(AttrUInt(domElem, AttrP1Line))) - .arg(PointName(AttrUInt(domElem, AttrP2Line))); + .arg(PointName(AttrUInt(domElem, AttrBasePoint)), + PointName(AttrUInt(domElem, AttrP1Line)), + PointName(AttrUInt(domElem, AttrP2Line))); case Tool::Triangle: return tr("Triangle: axis %1_%2, points %3 and %4") - .arg(PointName(AttrUInt(domElem, AttrAxisP1))) - .arg(PointName(AttrUInt(domElem, AttrAxisP2))) - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))); + .arg(PointName(AttrUInt(domElem, AttrAxisP1)), + PointName(AttrUInt(domElem, AttrAxisP2)), + PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint))); case Tool::PointOfIntersection: return tr("%1 - point of intersection %2 and %3") - .arg(PointName(tool.getId())) - .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) - .arg(PointName(AttrUInt(domElem, AttrSecondPoint))); + .arg(PointName(tool.getId()), + PointName(AttrUInt(domElem, AttrFirstPoint)), + PointName(AttrUInt(domElem, AttrSecondPoint))); case Tool::CutArc: { const QSharedPointer arc = data->GeometricObject(AttrUInt(domElem, AttrArc)); SCASSERT(not arc.isNull()) return tr("%1 - cut %2") - .arg(PointName(tool.getId())) - .arg(arc->NameForHistory(tr("arc"))); + .arg(PointName(tool.getId()), arc->NameForHistory(tr("arc"))); } case Tool::CutSpline: { @@ -344,8 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const QSharedPointer spl = data->GeometricObject(splineId); SCASSERT(not spl.isNull()) return tr("%1 - cut %2") - .arg(PointName(tool.getId())) - .arg(spl->NameForHistory(tr("curve"))); + .arg(PointName(tool.getId()), spl->NameForHistory(tr("curve"))); } case Tool::CutSplinePath: { @@ -354,19 +348,17 @@ QString DialogHistory::Record(const VToolRecord &tool) data->GeometricObject(splinePathId); SCASSERT(not splPath.isNull()) return tr("%1 - cut %2") - .arg(PointName(tool.getId())) - .arg(splPath->NameForHistory(tr("curve path"))); + .arg(PointName(tool.getId()), splPath->NameForHistory(tr("curve path"))); } case Tool::LineIntersectAxis: return tr("%1 - point of intersection line %2_%3 and axis through point %4") - .arg(PointName(tool.getId())) - .arg(PointName(AttrUInt(domElem, AttrP1Line))) - .arg(PointName(AttrUInt(domElem, AttrP2Line))) - .arg(PointName(AttrUInt(domElem, AttrBasePoint))); + .arg(PointName(tool.getId()), + PointName(AttrUInt(domElem, AttrP1Line)), + PointName(AttrUInt(domElem, AttrP2Line)), + PointName(AttrUInt(domElem, AttrBasePoint))); case Tool::CurveIntersectAxis: return tr("%1 - point of intersection curve and axis through point %2") - .arg(PointName(tool.getId())) - .arg(PointName(AttrUInt(domElem, AttrBasePoint))); + .arg(PointName(tool.getId()), PointName(AttrUInt(domElem, AttrBasePoint))); case Tool::PointOfIntersectionArcs: return tr("%1 - point of arcs intersection").arg(PointName(tool.getId())); case Tool::PointOfIntersectionCircles: @@ -379,9 +371,9 @@ QString DialogHistory::Record(const VToolRecord &tool) return tr("%1 - point from arc and tangent").arg(PointName(tool.getId())); case Tool::TrueDarts: return tr("Correction the dart %1_%2_%3") - .arg(PointName(AttrUInt(domElem, AttrDartP1))) - .arg(PointName(AttrUInt(domElem, AttrDartP2))) - .arg(PointName(AttrUInt(domElem, AttrDartP2))); + .arg(PointName(AttrUInt(domElem, AttrDartP1)), + PointName(AttrUInt(domElem, AttrDartP2)), + PointName(AttrUInt(domElem, AttrDartP2))); case Tool::EllipticalArc: { const QSharedPointer elArc = data->GeometricObject(tool.getId()); diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 8321f2d31..e388b0946 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -285,7 +285,7 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS SCASSERT(table != nullptr) const QString header = table->horizontalHeaderItem(column)->text(); - const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit); + const QString unitHeader = QString("%1 (%2)").arg(header, unit); table->horizontalHeaderItem(column)->setText(unitHeader); } diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index c1478d323..95fd20c3d 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -636,7 +636,7 @@ void DialogLayoutSettings::DialogAccepted() { WriteSettings(); } - accepted(); + emit accepted(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index d6b236d47..70c621b82 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -40,11 +40,12 @@ #include #include #include +#include #ifndef Q_OS_WIN - const QString baseFilenameRegExp = QStringLiteral("^[^/]+$"); + Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^/]+$"))) #else - const QString baseFilenameRegExp = QStringLiteral("^[^\\:?\"*|/<>]+$"); + Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\:?\"*|/<>]+$"))) #endif bool DialogSaveLayout::havePdf = false; @@ -74,7 +75,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName SCASSERT(bOk != nullptr) bOk->setEnabled(false); - ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(baseFilenameRegExp), this)); + ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(*baseFilenameRegExp), this)); const QString mask = fileName+QLatin1String("_"); if (VApplication::IsGUIMode()) @@ -83,7 +84,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName } else { - if (QRegularExpression(baseFilenameRegExp).match(mask).hasMatch()) + if (QRegularExpression(*baseFilenameRegExp).match(mask).hasMatch()) { ui->lineEditFileName->setText(mask); } diff --git a/src/app/valentina/main.cpp b/src/app/valentina/main.cpp index 6c5b5ab57..a88d509af 100644 --- a/src/app/valentina/main.cpp +++ b/src/app/valentina/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(icons); Q_INIT_RESOURCE(toolicon); - QT_REQUIRE_VERSION(argc, argv, "5.2.0") + QT_REQUIRE_VERSION(argc, argv, "5.2.0")// clazy:exclude=qstring-arg #if defined(Q_OS_WIN) VAbstractApplication::WinAttachConsole(); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 35d4308b6..793a96910 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -87,6 +87,7 @@ #include #include #include +#include #if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #include @@ -106,11 +107,14 @@ Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow") QT_WARNING_POP -const QString autosavePrefix = QStringLiteral(".autosave"); +namespace +{ +Q_GLOBAL_STATIC_WITH_ARGS(const QString, autosavePrefix, (QLatin1String(".autosave"))) // String below need for getting translation for key Ctrl -const QString strQShortcut = QStringLiteral("QShortcut"); // Context -const QString strCtrl = QStringLiteral("Ctrl"); // String +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strQShortcut, (QLatin1String("QShortcut"))) // Context +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCtrl, (QLatin1String("Ctrl"))) // String +} //--------------------------------------------------------------------------------------------------------------------- /** @@ -282,7 +286,7 @@ void MainWindow::AddPP(const QString &PPName) pattern->ClearCalculationGObjects(); //Create single point - ui->view->itemClicked(nullptr);//hide options previous tool + emit ui->view->itemClicked(nullptr);//hide options previous tool const QString label = doc->GenerateLabel(LabelType::NewPatternPiece); const QPointF startPosition = StartPositionNewPP(); @@ -298,7 +302,7 @@ void MainWindow::AddPP(const QString &PPName) initData.nameActivPP = PPName; auto spoint = VToolBasePoint::Create(initData); - ui->view->itemClicked(spoint); + emit ui->view->itemClicked(spoint); SetEnableTool(true); SetEnableWidgets(true); @@ -621,7 +625,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons { // Try to load HiDPI versions of the cursors if availible auto cursorHidpiResource = QString(cursor).replace(".png", "@2x.png"); - if (QFileInfo(cursorResource).exists()) + if (QFileInfo::exists(cursorResource)) { cursorResource = cursorHidpiResource; } @@ -659,7 +663,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject); connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); - ui->view->itemClicked(nullptr); + emit ui->view->itemClicked(nullptr); } else { @@ -714,7 +718,7 @@ void MainWindow::ClosedDialog(int result) QGraphicsItem *tool = dynamic_cast(DrawTool::Create(dialogTool, scene, doc, pattern)); // Do not check for nullptr! See issue #719. - ui->view->itemClicked(tool); + emit ui->view->itemClicked(tool); } ArrowTool(true); } @@ -1155,7 +1159,7 @@ void MainWindow::ClosedDialogDuplicateDetail(int result) QGraphicsItem *tool = dynamic_cast(VToolSeamAllowance::Duplicate(dialogTool, scene, doc)); // Do not check for nullptr! See issue #719. - ui->view->itemClicked(tool); + emit ui->view->itemClicked(tool); } ArrowTool(true); } @@ -1166,7 +1170,7 @@ void MainWindow::ToolGroup(bool checked) ToolSelectGroupObjects(); const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - finish creation") - .arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData())); + .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); SetToolButton(checked, Tool::Group, ":/cursor/group_plus_cursor.png", tooltip, &MainWindow::ClosedDialogGroup); } @@ -1177,7 +1181,7 @@ void MainWindow::ToolRotation(bool checked) ToolSelectOperationObjects(); const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - confirm selection") - .arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData())); + .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); SetToolButtonWithApply(checked, Tool::Rotation, ":/cursor/rotation_cursor.png", tooltip, &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -1189,7 +1193,7 @@ void MainWindow::ToolFlippingByLine(bool checked) ToolSelectOperationObjects(); const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - confirm selection") - .arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData())); + .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); SetToolButtonWithApply(checked, Tool::FlippingByLine, ":/cursor/flipping_line_cursor.png", tooltip, &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -1201,7 +1205,7 @@ void MainWindow::ToolFlippingByAxis(bool checked) ToolSelectOperationObjects(); const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - confirm selection") - .arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData())); + .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); SetToolButtonWithApply(checked, Tool::FlippingByAxis, ":/cursor/flipping_axis_cursor.png", tooltip, &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -1213,7 +1217,7 @@ void MainWindow::ToolMove(bool checked) ToolSelectOperationObjects(); const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - confirm selection") - .arg(QCoreApplication::translate(strQShortcut.toUtf8().constData(), strCtrl.toUtf8().constData())); + .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); SetToolButtonWithApply(checked, Tool::Move, ":/cursor/move_cursor.png", tooltip, &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -2065,7 +2069,7 @@ void MainWindow::InitToolButtons() toolButtonPointerList.append(ui->toolButtonPointerOperations); toolButtonPointerList.append(ui->toolButtonPointerEllipticalArc); - for (auto pointer : toolButtonPointerList) + for (auto pointer : qAsConst(toolButtonPointerList)) { connect(pointer, &QToolButton::clicked, this, &MainWindow::ArrowTool); } @@ -2157,12 +2161,12 @@ void MainWindow::CancelTool() currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); - ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash + emit ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash switch ( currentTool ) { case Tool::Arrow: - for (auto pointer : toolButtonPointerList) + for (auto pointer : qAsConst(toolButtonPointerList)) { pointer->setChecked(false); } @@ -2340,7 +2344,7 @@ void MainWindow::ArrowTool(bool checked) { qCDebug(vMainWindow, "Arrow tool."); CancelTool(); - for (auto pointer : toolButtonPointerList) + for (auto pointer : qAsConst(toolButtonPointerList)) { pointer->setChecked(true); } @@ -2383,7 +2387,7 @@ void MainWindow::ArrowTool(bool checked) } else { - for (auto pointer : toolButtonPointerList) + for (auto pointer : qAsConst(toolButtonPointerList)) { pointer->setChecked(true); } @@ -2545,7 +2549,7 @@ void MainWindow::ActionDetails(bool checked) SaveCurrentScene(); currentScene = sceneDetails; - ui->view->itemClicked(nullptr); + emit ui->view->itemClicked(nullptr); ui->view->setScene(currentScene); RestoreCurrentScene(); @@ -2660,7 +2664,7 @@ void MainWindow::ActionLayout(bool checked) } currentScene = tempSceneLayout; - ui->view->itemClicked(nullptr); + emit ui->view->itemClicked(nullptr); ui->view->setScene(currentScene); if (mode == Draw::Calculation) @@ -2883,7 +2887,7 @@ bool MainWindow::Save() bool result = SavePattern(qApp->GetPPath(), error); if (result) { - QFile::remove(qApp->GetPPath() + autosavePrefix); + QFile::remove(qApp->GetPPath() + *autosavePrefix); m_curFileFormatVersion = VPatternConverter::PatternMaxVer; m_curFileFormatVersionStr = VPatternConverter::PatternMaxVerStr; } @@ -3011,7 +3015,7 @@ void MainWindow::FileClosedCorrect() qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles); // Remove autosave file - QFile autofile(qApp->GetPPath() + autosavePrefix); + QFile autofile(qApp->GetPPath() + *autosavePrefix); if (autofile.exists()) { autofile.remove(); @@ -3596,7 +3600,7 @@ QT_WARNING_POP ui->actionLast_tool->setEnabled(drawTools); - for (auto pointer : toolButtonPointerList) + for (auto pointer : qAsConst(toolButtonPointerList)) { pointer->setEnabled(drawTools || modelingTools); pointer->setChecked(drawTools || modelingTools); @@ -3683,7 +3687,7 @@ void MainWindow::AutoSavePattern() if (qApp->GetPPath().isEmpty() == false && this->isWindowModified() == true) { - QString autofile = qApp->GetPPath() + autosavePrefix; + QString autofile = qApp->GetPPath() + *autosavePrefix; QString error; SavePattern(autofile, error); } @@ -3886,7 +3890,7 @@ void MainWindow::LastUsedTool() switch ( lastUsedTool ) { case Tool::Arrow: - for (auto pointer : toolButtonPointerList) + for (auto pointer : qAsConst(toolButtonPointerList)) { pointer->setChecked(true); } @@ -4299,7 +4303,7 @@ void MainWindow::CreateActions() ui->actionShowCurveDetails->setChecked(qApp->ValentinaSettings()->IsShowCurveDetails()); connect(ui->actionShowCurveDetails, &QAction::triggered, this, [this](bool checked) { - ui->view->itemClicked(nullptr); + emit ui->view->itemClicked(nullptr); sceneDraw->EnableDetailsMode(checked); qApp->ValentinaSettings()->SetShowCurveDetails(checked); }); @@ -4640,7 +4644,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const QStringList filtered; for (int i = 0; i < files.size(); ++i) { - if (QFileInfo(files.at(i)).exists()) + if (QFileInfo::exists(files.at(i))) { filtered.append(files.at(i)); } @@ -4830,7 +4834,7 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) QStringList restoreFiles; for (int i = 0; i < files.size(); ++i) { - QFile file(files.at(i) + autosavePrefix); + QFile file(files.at(i) + *autosavePrefix); if (file.exists()) { restoreFiles.append(files.at(i)); @@ -4851,9 +4855,9 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) for (int i = 0; i < restoreFiles.size(); ++i) { QString error; - if (VDomDocument::SafeCopy(restoreFiles.at(i) + autosavePrefix, restoreFiles.at(i), error)) + if (VDomDocument::SafeCopy(restoreFiles.at(i) + *autosavePrefix, restoreFiles.at(i), error)) { - QFile autoFile(restoreFiles.at(i) + autosavePrefix); + QFile autoFile(restoreFiles.at(i) + *autosavePrefix); autoFile.remove(); LoadPattern(restoreFiles.at(i)); args.removeAll(restoreFiles.at(i));// Do not open file twice after we restore him. @@ -4861,7 +4865,7 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) else { qCDebug(vMainWindow, "Could not copy %s%s to %s %s", - qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(autosavePrefix), + qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(*autosavePrefix), qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(error)); } } @@ -5574,7 +5578,7 @@ bool MainWindow::IgnoreLocking(int error, const QString &path) } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectPoint() const +void MainWindow::ToolSelectPoint() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5598,21 +5602,21 @@ void MainWindow::ToolSelectPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectPointByRelease() const +void MainWindow::ToolSelectPointByRelease() { ToolSelectPoint(); emit ItemsSelection(SelectionType::ByMouseRelease); } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectPointByPress() const +void MainWindow::ToolSelectPointByPress() { ToolSelectPoint(); emit ItemsSelection(SelectionType::ByMousePress); } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectSpline() const +void MainWindow::ToolSelectSpline() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5638,7 +5642,7 @@ void MainWindow::ToolSelectSpline() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectSplinePath() const +void MainWindow::ToolSelectSplinePath() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5664,7 +5668,7 @@ void MainWindow::ToolSelectSplinePath() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectArc() const +void MainWindow::ToolSelectArc() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5690,7 +5694,7 @@ void MainWindow::ToolSelectArc() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectPointArc() const +void MainWindow::ToolSelectPointArc() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5716,7 +5720,7 @@ void MainWindow::ToolSelectPointArc() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectCurve() const +void MainWindow::ToolSelectCurve() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5742,7 +5746,7 @@ void MainWindow::ToolSelectCurve() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectAllDrawObjects() const +void MainWindow::ToolSelectAllDrawObjects() { // Only true for rubber band selection emit EnableLabelSelection(false); @@ -5768,7 +5772,7 @@ void MainWindow::ToolSelectAllDrawObjects() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectOperationObjects() const +void MainWindow::ToolSelectOperationObjects() { // Only true for rubber band selection emit EnableLabelSelection(true); @@ -5794,7 +5798,7 @@ void MainWindow::ToolSelectOperationObjects() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectGroupObjects() const +void MainWindow::ToolSelectGroupObjects() { ToolSelectOperationObjects(); // Only true for rubber band selection @@ -5805,7 +5809,7 @@ void MainWindow::ToolSelectGroupObjects() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectDetail() const +void MainWindow::ToolSelectDetail() { // Only true for rubber band selection emit EnableNodeLabelSelection(false); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index c9b69e2a1..bb34cf391 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -74,29 +74,29 @@ public slots: signals: void RefreshHistory(); void EnableItemMove(bool move); - void ItemsSelection(SelectionType type) const; + void ItemsSelection(SelectionType type); - void EnableLabelSelection(bool enable) const; - void EnablePointSelection(bool enable) const; - void EnableLineSelection(bool enable) const; - void EnableArcSelection(bool enable) const; - void EnableElArcSelection(bool enable) const; - void EnableSplineSelection(bool enable) const; - void EnableSplinePathSelection(bool enable) const; - void EnableNodeLabelSelection(bool enable) const; - void EnableNodePointSelection(bool enable) const; - void EnableDetailSelection(bool enable) const; + void EnableLabelSelection(bool enable); + void EnablePointSelection(bool enable); + void EnableLineSelection(bool enable); + void EnableArcSelection(bool enable); + void EnableElArcSelection(bool enable); + void EnableSplineSelection(bool enable); + void EnableSplinePathSelection(bool enable); + void EnableNodeLabelSelection(bool enable); + void EnableNodePointSelection(bool enable); + void EnableDetailSelection(bool enable); - void EnableLabelHover(bool enable) const; - void EnablePointHover(bool enable) const; - void EnableLineHover(bool enable) const; - void EnableArcHover(bool enable) const; - void EnableElArcHover(bool enable) const; - void EnableSplineHover(bool enable) const; - void EnableSplinePathHover(bool enable) const; - void EnableNodeLabelHover(bool enable) const; - void EnableNodePointHover(bool enable) const; - void EnableDetailHover(bool enable) const; + void EnableLabelHover(bool enable); + void EnablePointHover(bool enable); + void EnableLineHover(bool enable); + void EnableArcHover(bool enable); + void EnableElArcHover(bool enable); + void EnableSplineHover(bool enable); + void EnableSplinePathHover(bool enable); + void EnableNodeLabelHover(bool enable); + void EnableNodePointHover(bool enable); + void EnableDetailHover(bool enable); protected: virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; @@ -377,18 +377,18 @@ private: bool IgnoreLocking(int error, const QString &path); - void ToolSelectPoint() const; - void ToolSelectPointByPress() const; - void ToolSelectPointByRelease() const; - void ToolSelectSpline() const; - void ToolSelectSplinePath() const; - void ToolSelectArc() const; - void ToolSelectPointArc() const; - void ToolSelectCurve() const; - void ToolSelectAllDrawObjects() const; - void ToolSelectOperationObjects() const; - void ToolSelectGroupObjects() const; - void ToolSelectDetail() const; + void ToolSelectPoint(); + void ToolSelectPointByPress(); + void ToolSelectPointByRelease(); + void ToolSelectSpline(); + void ToolSelectSplinePath(); + void ToolSelectArc(); + void ToolSelectPointArc(); + void ToolSelectCurve(); + void ToolSelectAllDrawObjects(); + void ToolSelectOperationObjects(); + void ToolSelectGroupObjects(); + void ToolSelectDetail(); }; #endif // MAINWINDOW_H diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 23a80389b..5dc3cfac1 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -1082,7 +1082,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const QFile f(params.last()); if (f.exists() == false) { - const QString msg = tr("Creating file '%1' failed! %2").arg(params.last()).arg(proc.errorString()); + const QString msg = tr("Creating file '%1' failed! %2").arg(params.last(), proc.errorString()); QMessageBox msgBox(QMessageBox::Critical, tr("Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default); msgBox.exec(); } diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp index 9b8e67b95..7e89d896b 100644 --- a/src/libs/fervor/fvupdater.cpp +++ b/src/libs/fervor/fvupdater.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include "../ifc/exception/vexception.h" #include "../ifc/xml/vabstractconverter.h" @@ -54,8 +55,10 @@ namespace { -const QString defaultFeedURL = QStringLiteral("https://valentinaproject.bitbucket.io/Appcast.xml"); -const QString testFeedURL = QStringLiteral("https://valentinaproject.bitbucket.io/Appcast_testing.xml"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL, + (QLatin1String("https://valentinaproject.bitbucket.io/Appcast.xml"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL, + (QLatin1String("https://valentinaproject.bitbucket.io/Appcast_testing.xml"))) } QPointer FvUpdater::m_Instance; @@ -86,7 +89,7 @@ void FvUpdater::drop() //--------------------------------------------------------------------------------------------------------------------- QString FvUpdater::CurrentFeedURL() { - return FvUpdater::IsTestBuild() ? testFeedURL : defaultFeedURL; + return FvUpdater::IsTestBuild() ? *testFeedURL : *defaultFeedURL; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/exception/vexception.cpp b/src/libs/ifc/exception/vexception.cpp index 25831f4cf..0df7334b4 100644 --- a/src/libs/ifc/exception/vexception.cpp +++ b/src/libs/ifc/exception/vexception.cpp @@ -134,12 +134,6 @@ Q_NORETURN void VException::raise() const throw *this; } -//--------------------------------------------------------------------------------------------------------------------- -const char* VException::what() const V_NOEXCEPT_EXPR (true) -{ - return error.toUtf8().constData(); -} - //-----------------------------------------VExceptionToolWasDeleted---------------------------------------------------- VExceptionToolWasDeleted::VExceptionToolWasDeleted(const QString &error) :VException(error) diff --git a/src/libs/ifc/exception/vexception.h b/src/libs/ifc/exception/vexception.h index ec0b73f91..612eecf11 100644 --- a/src/libs/ifc/exception/vexception.h +++ b/src/libs/ifc/exception/vexception.h @@ -58,7 +58,6 @@ public: QString WhatUtf8() const V_NOEXCEPT_EXPR (true); void AddMoreInformation(const QString &info); QString MoreInformation() const; - virtual const char* what() const V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE; protected: /** @brief error string with error */ diff --git a/src/libs/ifc/exception/vexceptionbadid.cpp b/src/libs/ifc/exception/vexceptionbadid.cpp index c76a5593f..34dc665fa 100644 --- a/src/libs/ifc/exception/vexceptionbadid.cpp +++ b/src/libs/ifc/exception/vexceptionbadid.cpp @@ -83,7 +83,7 @@ QString VExceptionBadId::ErrorMessage() const } else { - error = QString("ExceptionBadId: %1, id = %2").arg(this->error).arg(key); + error = QString("ExceptionBadId: %1, id = %2").arg(this->error, key); } return error; } diff --git a/src/libs/ifc/xml/vabstractconverter.cpp b/src/libs/ifc/xml/vabstractconverter.cpp index eb3657c5a..0c9e0d0a6 100644 --- a/src/libs/ifc/xml/vabstractconverter.cpp +++ b/src/libs/ifc/xml/vabstractconverter.cpp @@ -178,10 +178,7 @@ void VAbstractConverter::ReserveFile() const QString error; QFileInfo info(m_convertedFileName); const QString reserveFileName = QString("%1/%2(v%3).%4.bak") - .arg(info.absoluteDir().absolutePath()) - .arg(info.baseName()) - .arg(GetVersionStr()) - .arg(info.completeSuffix()); + .arg(info.absoluteDir().absolutePath(), info.baseName(), GetVersionStr(), info.completeSuffix()); if (not SafeCopy(m_convertedFileName, reserveFileName, error)) { #ifdef Q_OS_WIN32 diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index 66c899db5..27fb45606 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -633,7 +633,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) // cppcheck-suppress ConfigurationNotChecked if (pattern.open(QIODevice::ReadOnly) == false) { - const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString())); + const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, pattern.errorString())); throw VException(errorMsg); } @@ -642,7 +642,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) if (fileSchema.open(QIODevice::ReadOnly) == false) { pattern.close(); - const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString())); + const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema, fileSchema.errorString())); throw VException(errorMsg); } @@ -693,7 +693,7 @@ void VDomDocument::setXMLContent(const QString &fileName) // cppcheck-suppress ConfigurationNotChecked if (file.open(QIODevice::ReadOnly) == false) { - const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(file.errorString())); + const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, file.errorString())); throw VException(errorMsg); } diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index dfa836f1c..d95c14f15 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "../exception/vexception.h" #include "../exception/vexceptionemptyparameter.h" @@ -64,104 +65,107 @@ const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pa //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! +namespace +{ // The list of all string we use for conversion // Better to use global variables because repeating QStringLiteral blows up code size -static const QString strUnit = QStringLiteral("unit"); -static const QString strVersion = QStringLiteral("version"); -static const QString strName = QStringLiteral("name"); -static const QString strBase = QStringLiteral("base"); -static const QString strFormula = QStringLiteral("formula"); -static const QString strId = QStringLiteral("id"); -static const QString strKGrowth = QStringLiteral("kgrowth"); -static const QString strKSize = QStringLiteral("ksize"); -static const QString strPoint = QStringLiteral("point"); -static const QString strLength = QStringLiteral("length"); -static const QString strAngle = QStringLiteral("angle"); -static const QString strC1Radius = QStringLiteral("c1Radius"); -static const QString strC2Radius = QStringLiteral("c2Radius"); -static const QString strCRadius = QStringLiteral("cRadius"); -static const QString strArc = QStringLiteral("arc"); -static const QString strAngle1 = QStringLiteral("angle1"); -static const QString strAngle2 = QStringLiteral("angle2"); -static const QString strRadius = QStringLiteral("radius"); -static const QString strPathPoint = QStringLiteral("pathPoint"); -static const QString strKAsm1 = QStringLiteral("kAsm1"); -static const QString strKAsm2 = QStringLiteral("kAsm2"); -static const QString strPath = QStringLiteral("path"); -static const QString strType = QStringLiteral("type"); -static const QString strCutArc = QStringLiteral("cutArc"); -static const QString strSpline = QStringLiteral("spline"); -static const QString strSplinePath = QStringLiteral("splinePath"); -static const QString strCutSpline = QStringLiteral("cutSpline"); -static const QString strCutSplinePath = QStringLiteral("cutSplinePath"); -static const QString strColor = QStringLiteral("color"); -static const QString strMeasurements = QStringLiteral("measurements"); -static const QString strIncrement = QStringLiteral("increment"); -static const QString strIncrements = QStringLiteral("increments"); -static const QString strPreviewCalculations = QStringLiteral("previewCalculations"); -static const QString strModeling = QStringLiteral("modeling"); -static const QString strTools = QStringLiteral("tools"); -static const QString strIdTool = QStringLiteral("idTool"); -static const QString strIdObject = QStringLiteral("idObject"); -static const QString strChildren = QStringLiteral("children"); -static const QString strChild = QStringLiteral("child"); -static const QString strPointOfIntersectionCurves = QStringLiteral("pointOfIntersectionCurves"); -static const QString strCurveIntersectAxis = QStringLiteral("curveIntersectAxis"); -static const QString strCurve = QStringLiteral("curve"); -static const QString strCurve1 = QStringLiteral("curve1"); -static const QString strCurve2 = QStringLiteral("curve2"); -static const QString strModelingPath = QStringLiteral("modelingPath"); -static const QString strModelingSpline = QStringLiteral("modelingSpline"); -static const QString strPointFromArcAndTangent = QStringLiteral("pointFromArcAndTangent"); -static const QString strPointOfIntersectionArcs = QStringLiteral("pointOfIntersectionArcs"); -static const QString strFirstArc = QStringLiteral("firstArc"); -static const QString strSecondArc = QStringLiteral("secondArc"); -static const QString strDetail = QStringLiteral("detail"); -static const QString strSupplement = QStringLiteral("supplement"); -static const QString strClosed = QStringLiteral("closed"); -static const QString strWidth = QStringLiteral("width"); -static const QString strHeight = QStringLiteral("height"); -static const QString strNode = QStringLiteral("node"); -static const QString strNodes = QStringLiteral("nodes"); -static const QString strData = QStringLiteral("data"); -static const QString strPatternInfo = QStringLiteral("patternInfo"); -static const QString strGrainline = QStringLiteral("grainline"); -static const QString strReverse = QStringLiteral("reverse"); -static const QString strMx = QStringLiteral("mx"); -static const QString strMy = QStringLiteral("my"); -static const QString strForbidFlipping = QStringLiteral("forbidFlipping"); -static const QString strInLayout = QStringLiteral("inLayout"); -static const QString strSeamAllowance = QStringLiteral("seamAllowance"); -static const QString strNodeType = QStringLiteral("nodeType"); -static const QString strDet = QStringLiteral("det"); -static const QString strTypeObject = QStringLiteral("typeObject"); -static const QString strReadOnly = QStringLiteral("readOnly"); -static const QString strPatternLabel = QStringLiteral("patternLabel"); -static const QString strImage = QStringLiteral("image"); -static const QString strAuthor = QStringLiteral("author"); -static const QString strDescription = QStringLiteral("description"); -static const QString strNotes = QStringLiteral("notes"); -static const QString strGradation = QStringLiteral("gradation"); -static const QString strPatternName = QStringLiteral("patternName"); -static const QString strPatternNum = QStringLiteral("patternNumber"); -static const QString strCompanyName = QStringLiteral("company"); -static const QString strCustomerName = QStringLiteral("customer"); -static const QString strLine = QStringLiteral("line"); -static const QString strText = QStringLiteral("text"); -static const QString strBold = QStringLiteral("bold"); -static const QString strItalic = QStringLiteral("italic"); -static const QString strAlignment = QStringLiteral("alignment"); -static const QString strFSIncrement = QStringLiteral("sfIncrement"); -static const QString strShowDate = QStringLiteral("showDate"); -static const QString strShowMeasurements = QStringLiteral("showMeasurements"); -static const QString strSize = QStringLiteral("size"); -static const QString strMCP = QStringLiteral("mcp"); -static const QString strLetter = QStringLiteral("letter"); -static const QString strMaterial = QStringLiteral("material"); -static const QString strUserDefined = QStringLiteral("userDef"); -static const QString strPlacement = QStringLiteral("placement"); -static const QString strCutNumber = QStringLiteral("cutNumber"); -static const QString strQuantity = QStringLiteral("quantity"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUnit, (QLatin1String("unit"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVersion, (QLatin1String("version"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strName, (QLatin1String("name"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBase, (QLatin1String("base"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFormula, (QLatin1String("formula"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strId, (QLatin1String("id"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKGrowth , (QLatin1String("kgrowth"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKSize, (QLatin1String("ksize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPoint, (QLatin1String("point"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLength, (QLatin1String("length"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle, (QLatin1String("angle"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strC1Radius, (QLatin1String("c1Radius"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strC2Radius, (QLatin1String("c2Radius"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCRadius, (QLatin1String("cRadius"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strArc, (QLatin1String("arc"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle1, (QLatin1String("angle1"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle2, (QLatin1String("angle2"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strRadius, (QLatin1String("radius"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPathPoint, (QLatin1String("pathPoint"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKAsm1, (QLatin1String("kAsm1"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKAsm2, (QLatin1String("kAsm2"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPath, (QLatin1String("path"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strType, (QLatin1String("type"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutArc, (QLatin1String("cutArc"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSpline, (QLatin1String("spline"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSplinePath, (QLatin1String("splinePath"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutSpline, (QLatin1String("cutSpline"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutSplinePath, (QLatin1String("cutSplinePath"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strColor, (QLatin1String("color"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMeasurements, (QLatin1String("measurements"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIncrement, (QLatin1String("increment"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIncrements, (QLatin1String("increments"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPreviewCalculations, (QLatin1String("previewCalculations"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModeling, (QLatin1String("modeling"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTools, (QLatin1String("tools"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdTool, (QLatin1String("idTool"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdObject, (QLatin1String("idObject"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChildren, (QLatin1String("children"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChild, (QLatin1String("child"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionCurves, (QLatin1String("pointOfIntersectionCurves"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurveIntersectAxis, (QLatin1String("curveIntersectAxis"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve, (QLatin1String("curve"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve1, (QLatin1String("curve1"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve2, (QLatin1String("curve2"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingPath, (QLatin1String("modelingPath"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingSpline, (QLatin1String("modelingSpline"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointFromArcAndTangent, (QLatin1String("pointFromArcAndTangent"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionArcs, (QLatin1String("pointOfIntersectionArcs"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstArc, (QLatin1String("firstArc"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSecondArc, (QLatin1String("secondArc"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDetail, (QLatin1String("detail"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSupplement, (QLatin1String("supplement"))) +//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strClosed, (QLatin1String("closed"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strWidth, (QLatin1String("width"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strHeight, (QLatin1String("height"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNode, (QLatin1String("node"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodes, (QLatin1String("nodes"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strData, (QLatin1String("data"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternInfo, (QLatin1String("patternInfo"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGrainline, (QLatin1String("grainline"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strReverse, (QLatin1String("reverse"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMx, (QLatin1String("mx"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMy, (QLatin1String("my"))) +//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strForbidFlipping, (QLatin1String("forbidFlipping"))) +//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strInLayout, (QLatin1String("inLayout"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamAllowance, (QLatin1String("seamAllowance"))) +//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodeType, (QLatin1String("nodeType"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDet, (QLatin1String("det"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTypeObject, (QLatin1String("typeObject"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strReadOnly, (QLatin1String("readOnly"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternLabel, (QLatin1String("patternLabel"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strImage, (QLatin1String("image"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAuthor, (QLatin1String("author"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDescription, (QLatin1String("description"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNotes, (QLatin1String("notes"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGradation, (QLatin1String("gradation"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternName, (QLatin1String("patternName"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternNum, (QLatin1String("patternNumber"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCompanyName, (QLatin1String("company"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomerName, (QLatin1String("customer"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLine, (QLatin1String("line"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strText, (QLatin1String("text"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBold, (QLatin1String("bold"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strItalic, (QLatin1String("italic"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAlignment, (QLatin1String("alignment"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFSIncrement, (QLatin1String("sfIncrement"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strShowDate, (QLatin1String("showDate"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strShowMeasurements, (QLatin1String("showMeasurements"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSize, (QLatin1String("size"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMCP, (QLatin1String("mcp"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLetter, (QLatin1String("letter"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMaterial , (QLatin1String("material"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUserDefined, (QLatin1String("userDef"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPlacement, (QLatin1String("placement"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutNumber, (QLatin1String("cutNumber"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strQuantity, (QLatin1String("quantity"))) +} //--------------------------------------------------------------------------------------------------------------------- VPatternConverter::VPatternConverter(const QString &fileName) @@ -465,7 +469,7 @@ bool VPatternConverter::IsReadOnly() const return false; } - return GetParametrBool(pattern, strReadOnly, falseStr); + return GetParametrBool(pattern, *strReadOnly, falseStr); } //--------------------------------------------------------------------------------------------------------------------- @@ -775,8 +779,8 @@ void VPatternConverter::ToV0_4_4() "Time to refactor the code."); SetVersion(QStringLiteral("0.4.4")); - LabelTagToV0_4_4(strData); - LabelTagToV0_4_4(strPatternInfo); + LabelTagToV0_4_4(*strData); + LabelTagToV0_4_4(*strPatternInfo); Save(); } @@ -1002,12 +1006,12 @@ void VPatternConverter::TagUnitToV0_2_0() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 0), "Time to refactor the code."); - QDomElement unit = createElement(strUnit); + QDomElement unit = createElement(*strUnit); QDomText newNodeText = createTextNode(MUnitV0_1_4()); unit.appendChild(newNodeText); QDomElement patternElement = documentElement(); - patternElement.insertAfter(unit, patternElement.firstChildElement(strVersion)); + patternElement.insertAfter(unit, patternElement.firstChildElement(*strVersion)); } //--------------------------------------------------------------------------------------------------------------------- @@ -1054,16 +1058,16 @@ QSet VPatternConverter::FixIncrementsToV0_2_0() QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - if (domElement.tagName() == strIncrement) + if (domElement.tagName() == *strIncrement) { try { - const QString name = GetParametrString(domElement, strName); + const QString name = GetParametrString(domElement, *strName); names.insert(name); - domElement.setAttribute(strName, QLatin1String("#")+name); + domElement.setAttribute(*strName, QLatin1String("#")+name); - const QString base = GetParametrString(domElement, strBase); - domElement.setAttribute(strFormula, base); + const QString base = GetParametrString(domElement, *strBase); + domElement.setAttribute(*strFormula, base); } catch (VExceptionEmptyParameter &e) { @@ -1071,10 +1075,10 @@ QSet VPatternConverter::FixIncrementsToV0_2_0() excep.AddMoreInformation(e.ErrorMessage()); throw excep; } - domElement.removeAttribute(strId); - domElement.removeAttribute(strKGrowth); - domElement.removeAttribute(strKSize); - domElement.removeAttribute(strBase); + domElement.removeAttribute(*strId); + domElement.removeAttribute(*strKGrowth); + domElement.removeAttribute(*strKSize); + domElement.removeAttribute(*strBase); } } } @@ -1091,15 +1095,15 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) "Time to refactor the code."); QString formula; - const QDomNodeList list = elementsByTagName(strPoint); + const QDomNodeList list = elementsByTagName(*strPoint); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, strLength); - dom.setAttribute(strLength, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strLength); + dom.setAttribute(*strLength, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1108,8 +1112,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, strAngle); - dom.setAttribute(strAngle, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strAngle); + dom.setAttribute(*strAngle, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1117,8 +1121,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) } try { - formula = GetParametrString(dom, strC1Radius); - dom.setAttribute(strC1Radius, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strC1Radius); + dom.setAttribute(*strC1Radius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1127,8 +1131,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, strC2Radius); - dom.setAttribute(strC2Radius, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strC2Radius); + dom.setAttribute(*strC2Radius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1137,8 +1141,8 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, strCRadius); - dom.setAttribute(strCRadius, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strCRadius); + dom.setAttribute(*strCRadius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1155,15 +1159,15 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) "Time to refactor the code."); QString formula; - const QDomNodeList list = elementsByTagName(strArc); + const QDomNodeList list = elementsByTagName(*strArc); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, strAngle1); - dom.setAttribute(strAngle1, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strAngle1); + dom.setAttribute(*strAngle1, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1172,8 +1176,8 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, strAngle2); - dom.setAttribute(strAngle2, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strAngle2); + dom.setAttribute(*strAngle2, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1182,8 +1186,8 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, strRadius); - dom.setAttribute(strRadius, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strRadius); + dom.setAttribute(*strRadius, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1192,8 +1196,8 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet &names) try { - formula = GetParametrString(dom, strLength); - dom.setAttribute(strLength, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strLength); + dom.setAttribute(*strLength, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1210,15 +1214,15 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &nam "Time to refactor the code."); QString formula; - const QDomNodeList list = elementsByTagName(strPathPoint); + const QDomNodeList list = elementsByTagName(*strPathPoint); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); try { - formula = GetParametrString(dom, strKAsm1); - dom.setAttribute(strKAsm1, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strKAsm1); + dom.setAttribute(*strKAsm1, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1227,8 +1231,8 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &nam try { - formula = GetParametrString(dom, strKAsm2); - dom.setAttribute(strKAsm2, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strKAsm2); + dom.setAttribute(*strKAsm2, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1237,8 +1241,8 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet &nam try { - formula = GetParametrString(dom, strAngle); - dom.setAttribute(strAngle, FixIncrementInFormulaToV0_2_0(formula, names)); + formula = GetParametrString(dom, *strAngle); + dom.setAttribute(*strAngle, FixIncrementInFormulaToV0_2_0(formula, names)); } catch (VExceptionEmptyParameter &e) { @@ -1255,15 +1259,15 @@ void VPatternConverter::ConvertPointExpressionsToV0_2_0(const QMap children; QDomElement childNode = node.nextSibling().toElement(); while (not childNode.isNull()) { - if (childNode.hasAttribute(strIdTool) && childNode.attribute(strIdTool).toUInt() == toolId) + if (childNode.hasAttribute(*strIdTool) && childNode.attribute(*strIdTool).toUInt() == toolId) { - children.append(childNode.attribute(strIdObject).toUInt()); + children.append(childNode.attribute(*strIdObject).toUInt()); } else { @@ -1655,11 +1659,11 @@ void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector< return; } - QDomElement tagChildren = createElement(strChildren); + QDomElement tagChildren = createElement(*strChildren); for (int i=0; i VPatternConverter::OldNamesToNewNames_InV0_2_1() //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::FixCutPoint() { - const QStringList types = QStringList() << strCutSplinePath - << strCutSpline - << strCutArc; + const QStringList types = QStringList() << *strCutSplinePath + << *strCutSpline + << *strCutArc; - const QDomNodeList list = elementsByTagName(strPoint); + const QDomNodeList list = elementsByTagName(*strPoint); for (int i=0; i < list.size(); ++i) { QDomElement element = list.at(i).toElement(); if (not element.isNull()) { - const QString type = element.attribute(strType); + const QString type = element.attribute(*strType); switch(types.indexOf(type)) { case 0: //strCutSplinePath { - const quint32 id = element.attribute(strId).toUInt(); - quint32 curve = element.attribute(strSplinePath).toUInt(); + const quint32 id = element.attribute(*strId).toUInt(); + quint32 curve = element.attribute(*strSplinePath).toUInt(); FixSubPaths(i, id, curve); break; } case 1: //strCutSpline { - const quint32 id = element.attribute(strId).toUInt(); - quint32 curve = element.attribute(strSpline).toUInt(); + const quint32 id = element.attribute(*strId).toUInt(); + quint32 curve = element.attribute(*strSpline).toUInt(); FixSubPaths(i, id, curve); break; } case 2: //strCutArc { - const quint32 id = element.attribute(strId).toUInt(); - quint32 curve = element.attribute(strArc).toUInt(); + const quint32 id = element.attribute(*strId).toUInt(); + quint32 curve = element.attribute(*strArc).toUInt(); FixSubPaths(i, id, curve); break; } @@ -1910,85 +1914,85 @@ void VPatternConverter::FixCutPoint() //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) { - const QStringList pointTypes = QStringList() << strCutSplinePath - << strCutSpline - << strPointOfIntersectionCurves - << strCurveIntersectAxis - << strPointFromArcAndTangent - << strPointOfIntersectionArcs; + const QStringList pointTypes = QStringList() << *strCutSplinePath + << *strCutSpline + << *strPointOfIntersectionCurves + << *strCurveIntersectAxis + << *strPointFromArcAndTangent + << *strPointOfIntersectionArcs; - const QDomNodeList listPoints = elementsByTagName(strPoint); + const QDomNodeList listPoints = elementsByTagName(*strPoint); for (int j = i+1; j < listPoints.size(); ++j) { QDomElement element = listPoints.at(j).toElement(); if (not element.isNull()) { - const QString type = element.attribute(strType); + const QString type = element.attribute(*strType); switch(pointTypes.indexOf(type)) { case 0: //strCutSplinePath { - const quint32 spl = element.attribute(strSplinePath).toUInt(); + const quint32 spl = element.attribute(*strSplinePath).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strSplinePath, baseCurve); + element.setAttribute(*strSplinePath, baseCurve); } break; } case 1: //strCutSpline { - const quint32 spl = element.attribute(strSpline).toUInt(); + const quint32 spl = element.attribute(*strSpline).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strSpline, baseCurve); + element.setAttribute(*strSpline, baseCurve); } break; } case 2: //strPointOfIntersectionCurves { - quint32 spl = element.attribute(strCurve1).toUInt(); + quint32 spl = element.attribute(*strCurve1).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strCurve1, baseCurve); + element.setAttribute(*strCurve1, baseCurve); } - spl = element.attribute(strCurve2).toUInt(); + spl = element.attribute(*strCurve2).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strCurve2, baseCurve); + element.setAttribute(*strCurve2, baseCurve); } break; } case 3: //strCurveIntersectAxis { - const quint32 spl = element.attribute(strCurve).toUInt(); + const quint32 spl = element.attribute(*strCurve).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strCurve, baseCurve); + element.setAttribute(*strCurve, baseCurve); } break; } case 4: //strPointFromArcAndTangent { - const quint32 spl = element.attribute(strArc).toUInt(); + const quint32 spl = element.attribute(*strArc).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strArc, baseCurve); + element.setAttribute(*strArc, baseCurve); } break; } case 5: //strPointOfIntersectionArcs { - quint32 arc = element.attribute(strFirstArc).toUInt(); + quint32 arc = element.attribute(*strFirstArc).toUInt(); if (arc == id+1 || arc == id+2) { - element.setAttribute(strFirstArc, baseCurve); + element.setAttribute(*strFirstArc, baseCurve); } - arc = element.attribute(strSecondArc).toUInt(); + arc = element.attribute(*strSecondArc).toUInt(); if (arc == id+1 || arc == id+2) { - element.setAttribute(strSecondArc, baseCurve); + element.setAttribute(*strSecondArc, baseCurve); } break; } @@ -1998,25 +2002,25 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) } } - const QStringList splTypes = QStringList() << strModelingPath - << strModelingSpline; + const QStringList splTypes = QStringList() << *strModelingPath + << *strModelingSpline; - const QDomNodeList listSplines = elementsByTagName(strSpline); + const QDomNodeList listSplines = elementsByTagName(*strSpline); for (int j = 0; j < listSplines.size(); ++j) { QDomElement element = listSplines.at(j).toElement(); if (not element.isNull()) { - const QString type = element.attribute(strType); + const QString type = element.attribute(*strType); switch(splTypes.indexOf(type)) { case 0: //strModelingPath case 1: //strModelingSpline { - const quint32 spl = element.attribute(strIdObject).toUInt(); + const quint32 spl = element.attribute(*strIdObject).toUInt(); if (spl == id+1 || spl == id+2) { - element.setAttribute(strIdObject, baseCurve); + element.setAttribute(*strIdObject, baseCurve); } break; } @@ -2026,19 +2030,19 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) } } - const QDomNodeList listArcs = elementsByTagName(strArc); + const QDomNodeList listArcs = elementsByTagName(*strArc); for (int j = 0; j < listArcs.size(); ++j) { QDomElement element = listArcs.at(j).toElement(); if (not element.isNull()) { - const QString type = element.attribute(strType); - if (type == strModeling) + const QString type = element.attribute(*strType); + if (type == *strModeling) { - const quint32 arc = element.attribute(strIdObject).toUInt(); + const quint32 arc = element.attribute(*strIdObject).toUInt(); if (arc == id+1 || arc == id+2) { - element.setAttribute(strIdObject, baseCurve); + element.setAttribute(*strIdObject, baseCurve); } } } @@ -2052,7 +2056,7 @@ void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0), "Time to refactor the code."); - const QDomNodeList list = elementsByTagName(strModeling); + const QDomNodeList list = elementsByTagName(*strModeling); for (int i = 0; i < list.size(); ++i) { QDomElement modeling = list.at(i).toElement(); @@ -2064,9 +2068,9 @@ void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0() QDomElement domElement = domNode.toElement(); if (not domElement.isNull()) { - if (domElement.hasAttribute(strTypeObject)) + if (domElement.hasAttribute(*strTypeObject)) { - domElement.removeAttribute(strTypeObject); + domElement.removeAttribute(*strTypeObject); } } domNode = domNode.nextSibling(); @@ -2082,24 +2086,24 @@ void VPatternConverter::TagDetailToV0_4_0() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0), "Time to refactor the code."); - const QDomNodeList list = elementsByTagName(strDetail); + const QDomNodeList list = elementsByTagName(*strDetail); for (int i=0; i < list.size(); ++i) { QDomElement dom = list.at(i).toElement(); if (not dom.isNull()) { - dom.setAttribute(strSeamAllowance, dom.attribute(strSupplement, "0")); - dom.removeAttribute(strSupplement); + dom.setAttribute(*strSeamAllowance, dom.attribute(*strSupplement, "0")); + dom.removeAttribute(*strSupplement); - dom.setAttribute(strVersion, "1"); + dom.setAttribute(*strVersion, "1"); - const QStringList tags = QStringList() << strNode << strData << strPatternInfo << strGrainline; + const QStringList tags = QStringList() << *strNode << *strData << *strPatternInfo << *strGrainline; QDomElement tagData; QDomElement tagPatternInfo; QDomElement tagGrainline; - QDomElement tagNodes = createElement(strNodes); + QDomElement tagNodes = createElement(*strNodes); const QDomNodeList childList = dom.childNodes(); for (qint32 i = 0; i < childList.size(); ++i) @@ -2111,26 +2115,26 @@ void VPatternConverter::TagDetailToV0_4_0() { case 0://strNode { - QDomElement tagNode = createElement(strNode); + QDomElement tagNode = createElement(*strNode); - tagNode.setAttribute(strIdObject, element.attribute(strIdObject, NULL_ID_STR)); + tagNode.setAttribute(*strIdObject, element.attribute(*strIdObject, NULL_ID_STR)); - if (element.hasAttribute(strReverse)) + if (element.hasAttribute(*strReverse)) { - tagNode.setAttribute(strReverse, element.attribute(strReverse, "0")); + tagNode.setAttribute(*strReverse, element.attribute(*strReverse, "0")); } - if (element.hasAttribute(strMx)) + if (element.hasAttribute(*strMx)) { - tagNode.setAttribute(strMx, element.attribute(strMx, "0")); + tagNode.setAttribute(*strMx, element.attribute(*strMx, "0")); } - if (element.hasAttribute(strMy)) + if (element.hasAttribute(*strMy)) { - tagNode.setAttribute(strMy, element.attribute(strMy, "0")); + tagNode.setAttribute(*strMy, element.attribute(*strMy, "0")); } - tagNode.setAttribute(strType, element.attribute(strType, "")); + tagNode.setAttribute(*strType, element.attribute(*strType, "")); tagNodes.appendChild(tagNode); @@ -2164,7 +2168,7 @@ void VPatternConverter::TagDetailToV0_4_0() //--------------------------------------------------------------------------------------------------------------------- QDomElement VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &detail) { - QDomElement tagNodes = createElement(strNodes); + QDomElement tagNodes = createElement(*strNodes); if (not detail.isNull()) { @@ -2174,16 +2178,16 @@ QDomElement VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &deta const QDomElement node = childList.at(i).toElement(); if (not node.isNull()) { - QDomElement tagNode = createElement(strNode); + QDomElement tagNode = createElement(*strNode); - tagNode.setAttribute(strIdObject, node.attribute(strIdObject, NULL_ID_STR)); + tagNode.setAttribute(*strIdObject, node.attribute(*strIdObject, NULL_ID_STR)); - if (node.hasAttribute(strReverse)) + if (node.hasAttribute(*strReverse)) { - tagNode.setAttribute(strReverse, node.attribute(strReverse, "0")); + tagNode.setAttribute(*strReverse, node.attribute(*strReverse, "0")); } - tagNode.setAttribute(strType, node.attribute(strType, "")); + tagNode.setAttribute(*strType, node.attribute(*strType, "")); tagNodes.appendChild(tagNode); } @@ -2196,7 +2200,7 @@ QDomElement VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &deta //--------------------------------------------------------------------------------------------------------------------- QDomElement VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail) { - QDomElement tagNodes = createElement(strNodes); + QDomElement tagNodes = createElement(*strNodes); if (not detail.isNull()) { @@ -2224,7 +2228,7 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName) Unit unit = Unit::Cm; const QStringList units = QStringList() << "mm" << "cm" << "inch"; - switch (units.indexOf(UniqueTagText(strUnit))) + switch (units.indexOf(UniqueTagText(*strUnit))) { case 0:// mm unit = Unit::Mm; @@ -2261,8 +2265,8 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName) if (not dom.isNull()) { - ConvertData(dom, strWidth); - ConvertData(dom, strHeight); + ConvertData(dom, *strWidth); + ConvertData(dom, *strHeight); } } } @@ -2274,22 +2278,22 @@ QDomElement VPatternConverter::AddTagPatternLabelV0_5_1() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0), "Time to refactor the code."); - const QDomNodeList list = elementsByTagName(strPatternLabel); + const QDomNodeList list = elementsByTagName(*strPatternLabel); if (list.isEmpty()) { - const QStringList tags = QStringList() << strUnit - << strImage - << strAuthor - << strDescription - << strNotes - << strGradation - << strPatternName - << strPatternNum - << strCompanyName - << strCustomerName - << strPatternLabel; + const QStringList tags = QStringList() << *strUnit + << *strImage + << *strAuthor + << *strDescription + << *strNotes + << *strGradation + << *strPatternName + << *strPatternNum + << *strCompanyName + << *strCustomerName + << *strPatternLabel; - QDomElement element = createElement(strPatternLabel); + QDomElement element = createElement(*strPatternLabel); QDomElement pattern = documentElement(); for (int i = tags.indexOf(element.tagName())-1; i >= 0; --i) { @@ -2312,46 +2316,46 @@ void VPatternConverter::PortPatternLabeltoV0_6_0(QDomElement &label) Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0), "Time to refactor the code."); - if (not UniqueTagText(strCompanyName).isEmpty()) + if (not UniqueTagText(*strCompanyName).isEmpty()) { AddLabelTemplateLineV0_6_0(label, "%author%", true, false, 0, 4); } else { - const QString author = UniqueTagText(strAuthor); + const QString author = UniqueTagText(*strAuthor); if (not author.isEmpty()) { AddLabelTemplateLineV0_6_0(label, author, true, false, 0, 4); } } - if (not UniqueTagText(strPatternName).isEmpty()) + if (not UniqueTagText(*strPatternName).isEmpty()) { AddLabelTemplateLineV0_6_0(label, "%patternName%", false, false, 0, 2); } - if (not UniqueTagText(strPatternNum).isEmpty()) + if (not UniqueTagText(*strPatternNum).isEmpty()) { AddLabelTemplateLineV0_6_0(label, "%patternNumber%", false, false, 0, 0); } - if (not UniqueTagText(strCustomerName).isEmpty()) + if (not UniqueTagText(*strCustomerName).isEmpty()) { AddLabelTemplateLineV0_6_0(label, "%customer%", false, true, 0, 0); } - const QString sizeField = UniqueTagText(strSize); + const QString sizeField = UniqueTagText(*strSize); if (not sizeField.isEmpty()) { AddLabelTemplateLineV0_6_0(label, sizeField, false, false, 0, 0); } - if (UniqueTagText(strShowMeasurements) == trueStr) + if (UniqueTagText(*strShowMeasurements) == trueStr) { AddLabelTemplateLineV0_6_0(label, "%mFileName%.%mExt%", false, false, 0, 0); } - if (UniqueTagText(strShowDate) == trueStr) + if (UniqueTagText(*strShowDate) == trueStr) { AddLabelTemplateLineV0_6_0(label, "%date%", false, true, 0, 0); } @@ -2365,13 +2369,13 @@ void VPatternConverter::AddLabelTemplateLineV0_6_0(QDomElement &label, const QSt Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0), "Time to refactor the code."); - QDomElement tagLine = createElement(strLine); + QDomElement tagLine = createElement(*strLine); - SetAttribute(tagLine, strText, text); - SetAttribute(tagLine, strBold, bold); - SetAttribute(tagLine, strItalic, italic); - SetAttribute(tagLine, strAlignment, alignment); - SetAttribute(tagLine, strFSIncrement, fontSizeIncrement); + SetAttribute(tagLine, *strText, text); + SetAttribute(tagLine, *strBold, bold); + SetAttribute(tagLine, *strItalic, italic); + SetAttribute(tagLine, *strAlignment, alignment); + SetAttribute(tagLine, *strFSIncrement, fontSizeIncrement); label.appendChild(tagLine); } @@ -2383,7 +2387,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0), "Time to refactor the code."); - const QDomNodeList nodeList = elementsByTagName(strData); + const QDomNodeList nodeList = elementsByTagName(*strData); for (int i = 0; i < nodeList.size(); ++i) { QDomElement dataTag = nodeList.at(i).toElement(); @@ -2391,7 +2395,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() const int count = nodeListMCP.count(); try { - if (not GetParametrString(dataTag, strLetter, "").isEmpty()) + if (not GetParametrString(dataTag, *strLetter, "").isEmpty()) { AddLabelTemplateLineV0_6_0(dataTag, "%pLetter%", true, false, Qt::AlignHCenter, 6); } @@ -2410,7 +2414,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() QString line; - const int material = static_cast(GetParametrUInt(domMCP, strMaterial, "0")); + const int material = static_cast(GetParametrUInt(domMCP, *strMaterial, "0")); switch(material) { case 0: @@ -2427,18 +2431,18 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() break; case 4: default: - line.append(GetParametrString(domMCP, strUserDefined, "User material")); + line.append(GetParametrString(domMCP, *strUserDefined, "User material")); break; } line.append(", %wCut% "); - const int cutNumber = static_cast(GetParametrUInt(domMCP, strCutNumber, "1")); + const int cutNumber = static_cast(GetParametrUInt(domMCP, *strCutNumber, "1")); if (firstLine) { firstLineCutNumber = cutNumber; - dataTag.setAttribute(strQuantity, cutNumber); + dataTag.setAttribute(*strQuantity, cutNumber); line.append("%pQuantity%"); firstLine = false; } @@ -2454,7 +2458,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() } } - if (GetParametrUInt(domMCP, strPlacement, "0") == 1) + if (GetParametrUInt(domMCP, *strPlacement, "0") == 1) { line.append(" %wOnFold%"); } @@ -2471,19 +2475,19 @@ void VPatternConverter::RemoveUnusedTagsV0_6_0() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 0), "Time to refactor the code."); - RemoveUniqueTagV0_6_0(strAuthor); - RemoveUniqueTagV0_6_0(strSize); - RemoveUniqueTagV0_6_0(strShowDate); - RemoveUniqueTagV0_6_0(strShowMeasurements); + RemoveUniqueTagV0_6_0(*strAuthor); + RemoveUniqueTagV0_6_0(*strSize); + RemoveUniqueTagV0_6_0(*strShowDate); + RemoveUniqueTagV0_6_0(*strShowMeasurements); - QDomNodeList nodeList = elementsByTagName(strData); + QDomNodeList nodeList = elementsByTagName(*strData); for (int i = 0; i < nodeList.size(); ++i) { - QDomElement child = nodeList.at(i).firstChildElement(strMCP); + QDomElement child = nodeList.at(i).firstChildElement(*strMCP); while (not child.isNull()) { nodeList.at(i).removeChild(child); - child = nodeList.at(i).firstChildElement(strMCP); + child = nodeList.at(i).firstChildElement(*strMCP); } } } @@ -2512,11 +2516,11 @@ void VPatternConverter::AddTagPreviewCalculationsV0_6_2() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 2), "Time to refactor the code."); - const QDomNodeList list = elementsByTagName(strIncrements); + const QDomNodeList list = elementsByTagName(*strIncrements); if (not list.isEmpty()) { QDomElement pattern = documentElement(); - pattern.insertAfter(createElement(strPreviewCalculations), list.at(0)); + pattern.insertAfter(createElement(*strPreviewCalculations), list.at(0)); } } @@ -2527,17 +2531,17 @@ void VPatternConverter::TagUnionDetailsToV0_4_0() Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0), "Time to refactor the code."); - const QDomNodeList list = elementsByTagName(strTools); + const QDomNodeList list = elementsByTagName(*strTools); for (int i=0; i < list.size(); ++i) { // Tag 'tools' used only for union details, so no need to check any additional attributes QDomElement toolDOM = list.at(i).toElement(); if (not toolDOM.isNull()) { - const QStringList tags = QStringList() << strDet << strChildren; + const QStringList tags = QStringList() << *strDet << *strChildren; QVector nodes; - QDomElement tagChildrenNodes = createElement(strChildren); + QDomElement tagChildrenNodes = createElement(*strChildren); const QDomNodeList childList = toolDOM.childNodes(); for (qint32 i = 0; i < childList.size(); ++i) @@ -2563,7 +2567,7 @@ void VPatternConverter::TagUnionDetailsToV0_4_0() for (int i = 0; i < nodes.size(); ++i) { - QDomElement tagDet = createElement(strDet); + QDomElement tagDet = createElement(*strDet); tagDet.appendChild(nodes.at(i)); toolDOM.appendChild(tagDet); } diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index b33011736..41eba13bb 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "../exception/vexception.h" #include "../vmisc/def.h" @@ -59,13 +60,16 @@ const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/in //VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! +namespace +{ // The list of all string we use for conversion // Better to use global variables because repeating QStringLiteral blows up code size -static const QString strTagRead_Only = QStringLiteral("read-only"); -static const QString strGivenName = QStringLiteral("given-name"); -static const QString strFamilyName = QStringLiteral("family-name"); -static const QString strCustomer = QStringLiteral("customer"); -static const QString strPersonal = QStringLiteral("personal"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGivenName, (QLatin1String("given-name"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFamilyName, (QLatin1String("family-name"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomer, (QLatin1String("customer"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPersonal, (QLatin1String("personal"))) +} //--------------------------------------------------------------------------------------------------------------------- VVITConverter::VVITConverter(const QString &fileName) @@ -149,7 +153,7 @@ bool VVITConverter::IsReadOnly() const // For now position is the same for all supported format versions. // But don't forget to keep all versions of attribute until we support that format versions - return UniqueTagText(strTagRead_Only, falseStr) == trueStr; + return UniqueTagText(*strTagRead_Only, falseStr) == trueStr; } //--------------------------------------------------------------------------------------------------------------------- @@ -315,7 +319,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_3() void VVITConverter::ConverCustomerNameToV0_4_0() { // Find root tag - const QDomNodeList personalList = this->elementsByTagName(strPersonal); + const QDomNodeList personalList = this->elementsByTagName(*strPersonal); if (personalList.isEmpty()) { return; @@ -325,7 +329,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0() // Given name QString givenName; - const QDomNodeList givenNameList = this->elementsByTagName(strGivenName); + const QDomNodeList givenNameList = this->elementsByTagName(*strGivenName); if (not givenNameList.isEmpty()) { QDomNode givenNameNode = givenNameList.at(0); @@ -335,7 +339,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0() // Family name QString familyName; - const QDomNodeList familyNameList = this->elementsByTagName(strFamilyName); + const QDomNodeList familyNameList = this->elementsByTagName(*strFamilyName); if (not familyNameList.isEmpty()) { QDomNode familyNameNode = familyNameList.at(0); @@ -343,7 +347,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0() personal.removeChild(familyNameNode); } - QDomElement customer = createElement(strCustomer); + QDomElement customer = createElement(*strCustomer); QString customerName; if (not givenName.isEmpty() && not familyName.isEmpty()) diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index b8405dfac..9bc570858 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "../exception/vexception.h" #include "../vmisc/def.h" @@ -59,7 +60,10 @@ const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/st //VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! -static const QString strTagRead_Only = QStringLiteral("read-only"); +namespace +{ +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only"))) +} //--------------------------------------------------------------------------------------------------------------------- VVSTConverter::VVSTConverter(const QString &fileName) @@ -143,7 +147,7 @@ bool VVSTConverter::IsReadOnly() const // For now position is the same for all supported format versions. // But don't forget to keep all versions of attribute until we support that format versions - return UniqueTagText(strTagRead_Only, falseStr) == trueStr; + return UniqueTagText(*strTagRead_Only, falseStr) == trueStr; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/qmuparser/qmudef.cpp b/src/libs/qmuparser/qmudef.cpp index 4f876e0d9..92eee1476 100644 --- a/src/libs/qmuparser/qmudef.cpp +++ b/src/libs/qmuparser/qmudef.cpp @@ -323,7 +323,7 @@ QString NameRegExp() // \p{Zs} - \p{Space_Separator} regex = QString("^([^\\p{Nd}\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;'\"]){1,1}" "([^\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;\"]){0,}$") - .arg(negativeSigns).arg(positiveSigns).arg(decimalPoints).arg(groupSeparators); + .arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators); } return regex; diff --git a/src/libs/vformat/vmeasurements.cpp b/src/libs/vformat/vmeasurements.cpp index 961a978c6..dfa4dc4ab 100644 --- a/src/libs/vformat/vmeasurements.cpp +++ b/src/libs/vformat/vmeasurements.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include "../ifc/exception/vexceptionemptyparameter.h" #include "../ifc/xml/vvitconverter.h" @@ -82,10 +83,10 @@ const QString VMeasurements::GenderMale = QStringLiteral("male"); const QString VMeasurements::GenderFemale = QStringLiteral("female"); const QString VMeasurements::GenderUnknown = QStringLiteral("unknown"); -const QString defBirthDate = QStringLiteral("1800-01-01"); - namespace { +Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01"))) + //--------------------------------------------------------------------------------------------------------------------- QString FileComment() { @@ -400,7 +401,7 @@ void VMeasurements::SetCustomer(const QString &text) //--------------------------------------------------------------------------------------------------------------------- QDate VMeasurements::BirthDate() const { - return QDate::fromString(UniqueTagText(TagBirthDate, defBirthDate), "yyyy-MM-dd"); + return QDate::fromString(UniqueTagText(TagBirthDate, *defBirthDate), "yyyy-MM-dd"); } //--------------------------------------------------------------------------------------------------------------------- @@ -755,7 +756,7 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit) personal.appendChild(createElement(TagCustomer)); QDomElement date = createElement(TagBirthDate); - date.appendChild(createTextNode(defBirthDate)); + date.appendChild(createTextNode(*defBirthDate)); personal.appendChild(date); QDomElement gender = createElement(TagGender); diff --git a/src/libs/vgeometry/vabstractcubicbezier.cpp b/src/libs/vgeometry/vabstractcubicbezier.cpp index 347e87af2..223f851fe 100644 --- a/src/libs/vgeometry/vabstractcubicbezier.cpp +++ b/src/libs/vgeometry/vabstractcubicbezier.cpp @@ -136,7 +136,7 @@ QPointF VAbstractCubicBezier::CutSpline(qreal length, QPointF &spl1p2, QPointF & //--------------------------------------------------------------------------------------------------------------------- QString VAbstractCubicBezier::NameForHistory(const QString &toolName) const { - QString name = toolName + QString(" %1_%2").arg(GetP1().name()).arg(GetP4().name()); + QString name = toolName + QString(" %1_%2").arg(GetP1().name(), GetP4().name()); if (GetDuplicate() > 0) { name += QString("_%1").arg(GetDuplicate()); @@ -173,7 +173,7 @@ qreal VAbstractCubicBezier::GetParmT(qreal length) const //--------------------------------------------------------------------------------------------------------------------- void VAbstractCubicBezier::CreateName() { - QString name = SPL_ + QString("%1_%2").arg(GetP1().name()).arg(GetP4().name()); + QString name = SPL_ + QString("%1_%2").arg(GetP1().name(), GetP4().name()); if (GetDuplicate() > 0) { name += QString("_%1").arg(GetDuplicate()); diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index 49d89ff72..4f05beba0 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -277,7 +277,11 @@ QVector VEllipticalArc::GetPoints() const const QList sub = path.toSubpathPolygons(); if (not sub.isEmpty()) { - polygon = path.toSubpathPolygons().first(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + polygon = path.toSubpathPolygons().constFirst(); +#else + polygon = path.toSubpathPolygons().first(); // clazy:exclude=detaching-temporary +#endif if (not polygon.isEmpty()) { polygon.removeFirst(); // remove point (0;0) diff --git a/src/libs/vgeometry/vsplinepath.cpp b/src/libs/vgeometry/vsplinepath.cpp index cc850d596..7d0272541 100644 --- a/src/libs/vgeometry/vsplinepath.cpp +++ b/src/libs/vgeometry/vsplinepath.cpp @@ -328,7 +328,11 @@ qreal VSplinePath::GetStartAngle() const { if (CountPoints() > 0) { - return GetSplinePath().first().Angle2(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return GetSplinePath().constFirst().Angle2(); +#else + return GetSplinePath().first().Angle2(); // clazy:exclude=detaching-temporary +#endif } else { @@ -341,7 +345,11 @@ qreal VSplinePath::GetEndAngle() const { if (CountPoints() > 0) { - return GetSplinePath().last().Angle1(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return GetSplinePath().constLast().Angle1(); +#else + return GetSplinePath().last().Angle1(); // clazy:exclude=detaching-temporary +#endif } else { @@ -354,7 +362,11 @@ qreal VSplinePath::GetC1Length() const { if (CountPoints() > 0) { - return GetSplinePath().first().Length2(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return GetSplinePath().constFirst().Length2(); +#else + return GetSplinePath().first().Length2(); // clazy:exclude=detaching-temporary +#endif } else { @@ -367,7 +379,11 @@ qreal VSplinePath::GetC2Length() const { if (CountPoints() > 0) { - return GetSplinePath().last().Length1(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return GetSplinePath().constLast().Length1(); +#else + return GetSplinePath().last().Length1(); // clazy:exclude=detaching-temporary +#endif } else { @@ -380,7 +396,11 @@ VPointF VSplinePath::FirstPoint() const { if (not d->path.isEmpty()) { - return d->path.first().P(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return d->path.constFirst().P(); +#else + return d->path.first().P(); // clazy:exclude=detaching-temporary +#endif } else { diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 5a25fa3aa..12a8ab66c 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include "vabstractapplication.h" @@ -621,8 +622,9 @@ void InitHighDpiScaling(int argc, char *argv[]) const QString strOne = QStringLiteral("one"); const QString strTwo = QStringLiteral("two"); const QString strThree = QStringLiteral("three"); -const QString strTMark = QStringLiteral("tMark"); -const QString strVMark = QStringLiteral("vMark"); + +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, (QLatin1String("tMark"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark"))) //--------------------------------------------------------------------------------------------------------------------- QString PassmarkLineTypeToString(PassmarkLineType type) @@ -636,9 +638,9 @@ QString PassmarkLineTypeToString(PassmarkLineType type) case PassmarkLineType::ThreeLines: return strThree; case PassmarkLineType::TMark: - return strTMark; + return *strTMark; case PassmarkLineType::VMark: - return strVMark; + return *strVMark; default: break; } @@ -649,7 +651,7 @@ QString PassmarkLineTypeToString(PassmarkLineType type) //--------------------------------------------------------------------------------------------------------------------- PassmarkLineType StringToPassmarkLineType(const QString &value) { - const QStringList values = QStringList() << strOne << strTwo << strThree << strTMark << strVMark; + const QStringList values = QStringList() << strOne << strTwo << strThree << *strTMark << *strVMark; switch(values.indexOf(value)) { @@ -830,7 +832,7 @@ void InitLanguages(QComboBox *combobox) QLocale loc = QLocale(locale); QString lang = loc.nativeLanguageName(); - QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country()))); + QIcon ico(QString("%1/%2.png").arg("://flags", QLocale::countryToString(loc.country()))); combobox->addItem(ico, lang, locale); } @@ -838,7 +840,7 @@ void InitLanguages(QComboBox *combobox) if (combobox->count() == 0 || not englishUS) { // English language is internal and doens't have own *.qm file. - QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates))); + QIcon ico(QString("%1/%2.png").arg("://flags", QLocale::countryToString(QLocale::UnitedStates))); QString lang = QLocale(en_US).nativeLanguageName(); combobox->addItem(ico, lang, en_US); } diff --git a/src/libs/vmisc/defglobal.h b/src/libs/vmisc/defglobal.h index e2be61ecd..e8d0bb80b 100644 --- a/src/libs/vmisc/defglobal.h +++ b/src/libs/vmisc/defglobal.h @@ -35,4 +35,13 @@ #define PRINTDPI 96.0 extern const qreal PrintDPI; +#if QT_VERSION <= QT_VERSION_CHECK(5, 7, 0) +// this adds const to non-const objects (like std::as_const) +template +Q_DECL_CONSTEXPR typename std::add_const::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } +// prevent rvalue arguments: +template +void qAsConst(const T &&) Q_DECL_EQ_DELETE; +#endif + #endif // DEFGLOBAL_H diff --git a/src/libs/vmisc/qxtcsvmodel.cpp b/src/libs/vmisc/qxtcsvmodel.cpp index 16dd03cd5..a0cc9ffa5 100644 --- a/src/libs/vmisc/qxtcsvmodel.cpp +++ b/src/libs/vmisc/qxtcsvmodel.cpp @@ -399,7 +399,7 @@ bool QxtCsvModel::insertRows(int row, int count, const QModelIndex& parent) { return false; } - emit beginInsertRows(parent, row, row + count); + beginInsertRows(parent, row, row + count); QxtCsvModelPrivate& d_ptr = qxt_d(); if (row >= rowCount()) { @@ -415,7 +415,7 @@ bool QxtCsvModel::insertRows(int row, int count, const QModelIndex& parent) d_ptr.csvData.insert(row, QStringList()); } } - emit endInsertRows(); + endInsertRows(); return true; } @@ -444,13 +444,13 @@ bool QxtCsvModel::removeRows(int row, int count, const QModelIndex& parent) { count = rowCount() - row; } - emit beginRemoveRows(parent, row, row + count); + beginRemoveRows(parent, row, row + count); QxtCsvModelPrivate& d_ptr = qxt_d(); for (int i = 0;i < count;i++) { d_ptr.csvData.removeAt(row); } - emit endRemoveRows(); + endRemoveRows(); return true; } @@ -519,7 +519,7 @@ bool QxtCsvModel::removeColumns(int col, int count, const QModelIndex& parent) { count = columnCount() - col; } - emit beginRemoveColumns(parent, col, col + count); + beginRemoveColumns(parent, col, col + count); QxtCsvModelPrivate& d_ptr = qxt_d(); for (int i = 0; i < rowCount(); i++) { @@ -532,7 +532,7 @@ bool QxtCsvModel::removeColumns(int col, int count, const QModelIndex& parent) { d_ptr.header.removeAt(col); } - emit endRemoveColumns(); + endRemoveColumns(); return true; } diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 2ff8e4521..f418ed5b9 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "../vmisc/def.h" #include "../vmisc/vmath.h" @@ -47,58 +48,58 @@ namespace { -const QString settingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements"); -const QString settingPathsMultisizeMeasurements = QStringLiteral("paths/standard_measurements"); -const QString settingPathsTemplates = QStringLiteral("paths/templates"); -const QString settingPathsLabelTemplate = QStringLiteral("paths/labels"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, (QLatin1String("paths/individual_measurements"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, (QLatin1String("paths/standard_measurements"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, (QLatin1String("paths/templates"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels"))) -const QString settingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator"); -const QString settingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state"); -const QString settingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time"); -const QString settingConfigurationLocale = QStringLiteral("configuration/locale"); -const QString settingPMSystemCode = QStringLiteral("configuration/pmscode"); -const QString settingConfigurationUnit = QStringLiteral("configuration/unit"); -const QString settingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion"); -const QString settingConfigurationConfirmFormatRewriting = QStringLiteral("configuration/confirm_format_rewriting"); -const QString settingConfigurationToolBarStyle = QStringLiteral("configuration/tool_bar_style"); -const QString settingConfigurationFreeCurveMode = QStringLiteral("configuration/freeCurveMode"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, (QLatin1String("configuration/osSeparator"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState, (QLatin1String("configuration/autosave/state"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime , (QLatin1String("configuration/autosave/time"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, (QLatin1String("configuration/locale"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, (QLatin1String("configuration/pmscode"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, (QLatin1String("configuration/unit"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion, (QLatin1String("configuration/confirm_item_deletion"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting, (QLatin1String("configuration/confirm_format_rewriting"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode"))) -const QString settingPatternUndo = QStringLiteral("pattern/undo"); -const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping"); -const QString settingPatternForceFlipping = QStringLiteral("pattern/forceFlipping"); -const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath"); -const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark"); -const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance"); -const QString settingPatternLabelFont = QStringLiteral("pattern/labelFont"); -const QString settingPatternLineWidth = QStringLiteral("pattern/lineWidth"); -const QString settingPatternCurveApproximationScale = QStringLiteral("pattern/curveApproximationScale"); -const QString settingPatternShowCurveDetails = QStringLiteral("pattern/showCurveDetails"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, (QLatin1String("pattern/forceFlipping"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, (QLatin1String("pattern/hideMainPath"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, (QLatin1String("pattern/doublePassmark"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance, (QLatin1String("pattern/defaultSeamAllowance"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, (QLatin1String("pattern/labelFont"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, (QLatin1String("pattern/lineWidth"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale, (QLatin1String("pattern/curveApproximationScale"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin1String("pattern/showCurveDetails"))) -const QString settingGeneralRecentFileList = QStringLiteral("recentFileList"); -const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList"); -const QString settingGeneralGeometry = QStringLiteral("geometry"); -const QString settingGeneralWindowState = QStringLiteral("windowState"); -const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState"); -const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize"); -const QString settingToolSeamAllowanceDialogSize = QStringLiteral("toolSeamAllowanceDialogSize"); -const QString settingIncrementsDialogSize = QStringLiteral("toolIncrementsDialogSize"); -const QString settingFormulaWizardDialogSize = QStringLiteral("formulaWizardDialogSize"); -const QString settingFinalMeasurementsDialogSize = QStringLiteral("finalMeasurementsDialogSize"); -const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion"); -const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, (QLatin1String("geometry"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralWindowState, (QLatin1String("windowState"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, (QLatin1String("toolbarsState"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, (QLatin1String("toolSeamAllowanceDialogSize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) -const QString settingCSVWithHeader = QStringLiteral("csv/withHeader"); -const QString settingCSVCodec = QStringLiteral("csv/withCodec"); -const QString settingCSVSeparator = QStringLiteral("csv/withSeparator"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, (QLatin1String("csv/withHeader"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVCodec, (QLatin1String("csv/withCodec"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVSeparator, (QLatin1String("csv/withSeparator"))) -const QString settingLabelDateFormat = QStringLiteral("label/dateFormat"); -const QString settingLabelUserDateFormats = QStringLiteral("label/userDateFormats"); -const QString settingLabelTimeFormat = QStringLiteral("label/timeFormat"); -const QString settingLabelUserTimeFormats = QStringLiteral("label/userTimeFormats"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, (QLatin1String("label/dateFormat"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, (QLatin1String("label/userDateFormats"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, (QLatin1String("label/timeFormat"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, (QLatin1String("label/userTimeFormats"))) // Reading settings file is very expensive, cache curve approximation to speed up getting value qreal curveApproximationCached = -1; -QString localeCached = QString(); +Q_GLOBAL_STATIC(QString, localeCached) qreal lineWidthCached = 0; //--------------------------------------------------------------------------------------------------------------------- @@ -112,7 +113,7 @@ QStringList ClearFormats(const QStringList &predefinedFormats, QStringList forma } } -static const QString commonIniFilename = QStringLiteral("common"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, commonIniFilename, (QLatin1String("common"))) #if !defined(Q_OS_WIN) const QString VCommonSettings::unixStandardSharePath = QStringLiteral("/usr/share/valentina"); @@ -126,7 +127,8 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool QDir dir; dir.setPath(fromDir); - foreach (QString copyFile, dir.entryList(QDir::Files)) + const QStringList list = dir.entryList(QDir::Files); + for (const QString ©File : list) { const QString from = fromDir + QDir::separator() + copyFile; QString to = toDir + QDir::separator() + copyFile; @@ -188,7 +190,8 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool QFile::link(from, to); } - foreach (QString copyDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) + const QStringList dirList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + for (const QString ©Dir : dirList) { const QString from = fromDir + QDir::separator() + copyDir; const QString to = toDir + QDir::separator() + copyDir; @@ -315,15 +318,15 @@ QString VCommonSettings::GetDefPathIndividualMeasurements() //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetPathIndividualMeasurements() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetPathIndividualMeasurements(const QString &value) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingPathsIndividualMeasurements, value); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingPathsIndividualMeasurements, value); settings.sync(); } @@ -336,15 +339,15 @@ QString VCommonSettings::GetDefPathMultisizeMeasurements() //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetPathMultisizeMeasurements() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingPathsMultisizeMeasurements, GetDefPathMultisizeMeasurements()).toString(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingPathsMultisizeMeasurements, GetDefPathMultisizeMeasurements()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetPathMultisizeMeasurements(const QString &value) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingPathsMultisizeMeasurements, value); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingPathsMultisizeMeasurements, value); settings.sync(); } @@ -357,15 +360,15 @@ QString VCommonSettings::GetDefPathTemplate() //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetPathTemplate() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingPathsTemplates, GetDefPathTemplate()).toString(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingPathsTemplates, GetDefPathTemplate()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetPathTemplate(const QString &value) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingPathsTemplates, value); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingPathsTemplates, value); settings.sync(); } @@ -378,47 +381,47 @@ QString VCommonSettings::GetDefPathLabelTemplate() //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetPathLabelTemplate() const { - return value(settingPathsLabelTemplate, GetDefPathLabelTemplate()).toString(); + return value(*settingPathsLabelTemplate, GetDefPathLabelTemplate()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetPathLabelTemplate(const QString &value) { - setValue(settingPathsLabelTemplate, value); + setValue(*settingPathsLabelTemplate, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetOsSeparator() const { - return value(settingConfigurationOsSeparator, 1).toBool(); + return value(*settingConfigurationOsSeparator, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetOsSeparator(const bool &value) { - setValue(settingConfigurationOsSeparator, value); + setValue(*settingConfigurationOsSeparator, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetAutosaveState() const { - return value(settingConfigurationAutosaveState, 1).toBool(); + return value(*settingConfigurationAutosaveState, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetAutosaveState(const bool &value) { - setValue(settingConfigurationAutosaveState, value); + setValue(*settingConfigurationAutosaveState, value); } //--------------------------------------------------------------------------------------------------------------------- int VCommonSettings::GetAutosaveTime() const { bool ok = false; - int val = value(settingConfigurationAutosaveTime, 1).toInt(&ok); + int val = value(*settingConfigurationAutosaveTime, 1).toInt(&ok); if (ok == false) { - qDebug()<<"Could not convert value"<isEmpty()) { - localeCached = value(settingConfigurationLocale, QLocale().name()).toString(); + *localeCached = value(*settingConfigurationLocale, QLocale().name()).toString(); } - return localeCached; + return *localeCached; } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetLocale(const QString &value) { - setValue(settingConfigurationLocale, value); - localeCached = value; + setValue(*settingConfigurationLocale, value); + *localeCached = value; } //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetPMSystemCode() const { - return value(settingPMSystemCode, "p998").toString(); + return value(*settingPMSystemCode, "p998").toString(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetPMSystemCode(const QString &value) { - setValue(settingPMSystemCode, value); + setValue(*settingPMSystemCode, value); } //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetUnit() const { - return value(settingConfigurationUnit, + return value(*settingConfigurationUnit, QLocale().measurementSystem() == QLocale::MetricSystem ? unitCM : unitINCH).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetUnit(const QString &value) { - setValue(settingConfigurationUnit, value); + setValue(*settingConfigurationUnit, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetConfirmItemDelete() const { - return value(settingConfigurationConfirmItemDeletion, 1).toBool(); + return value(*settingConfigurationConfirmItemDeletion, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetConfirmItemDelete(const bool &value) { - setValue(settingConfigurationConfirmItemDeletion, value); + setValue(*settingConfigurationConfirmItemDeletion, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetConfirmFormatRewriting() const { - return value(settingConfigurationConfirmFormatRewriting, 1).toBool(); + return value(*settingConfigurationConfirmFormatRewriting, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetConfirmFormatRewriting(const bool &value) { - setValue(settingConfigurationConfirmFormatRewriting, value); + setValue(*settingConfigurationConfirmFormatRewriting, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetToolBarStyle() const { - return value(settingConfigurationToolBarStyle, 1).toBool(); + return value(*settingConfigurationToolBarStyle, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetToolBarStyle(const bool &value) { - setValue(settingConfigurationToolBarStyle, value); + setValue(*settingConfigurationToolBarStyle, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::IsFreeCurveMode() const { - return value(settingConfigurationFreeCurveMode, 1).toBool(); + return value(*settingConfigurationFreeCurveMode, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetFreeCurveMode(bool value) { - setValue(settingConfigurationFreeCurveMode, value); + setValue(*settingConfigurationFreeCurveMode, value); } //--------------------------------------------------------------------------------------------------------------------- int VCommonSettings::GetUndoCount() const { bool ok = false; - int val = value(settingPatternUndo, 0).toInt(&ok); + int val = value(*settingPatternUndo, 0).toInt(&ok); if (ok == false) { - qDebug()<<"Could not convert value"<format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingLatestSkippedVersion, 0x0).toInt(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingLatestSkippedVersion, 0x0).toInt(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetLatestSkippedVersion(int value) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingLatestSkippedVersion, value); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingLatestSkippedVersion, value); settings.sync(); } //--------------------------------------------------------------------------------------------------------------------- QDate VCommonSettings::GetDateOfLastRemind() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingDateOfLastRemind, QDate(1900, 1, 1)).toDate(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingDateOfLastRemind, QDate(1900, 1, 1)).toDate(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetDateOfLastRemind(const QDate &date) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingDateOfLastRemind, date); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingDateOfLastRemind, date); settings.sync(); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetForbidWorkpieceFlipping() const { - return value(settingPatternForbidFlipping, false).toBool(); + return value(*settingPatternForbidFlipping, false).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetForbidWorkpieceFlipping(bool value) { - setValue(settingPatternForbidFlipping, value); + setValue(*settingPatternForbidFlipping, value); if (value) { @@ -722,13 +725,13 @@ void VCommonSettings::SetForbidWorkpieceFlipping(bool value) //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetForceWorkpieceFlipping() const { - return value(settingPatternForceFlipping, false).toBool(); + return value(*settingPatternForceFlipping, false).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetForceWorkpieceFlipping(bool value) { - setValue(settingPatternForceFlipping, value); + setValue(*settingPatternForceFlipping, value); if (value) { @@ -739,39 +742,39 @@ void VCommonSettings::SetForceWorkpieceFlipping(bool value) //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::IsHideMainPath() const { - return value(settingPatternHideMainPath, false).toBool(); + return value(*settingPatternHideMainPath, false).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetHideMainPath(bool value) { - setValue(settingPatternHideMainPath, value); + setValue(*settingPatternHideMainPath, value); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::IsDoublePassmark() const { - return value(settingDoublePassmark, false).toBool(); + return value(*settingDoublePassmark, false).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetDoublePassmark(bool value) { - setValue(settingDoublePassmark, value); + setValue(*settingDoublePassmark, value); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetCSVWithHeader(bool withHeader) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingCSVWithHeader, withHeader); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingCSVWithHeader, withHeader); } //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetCSVWithHeader() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingCSVWithHeader, GetDefCSVWithHeader()).toBool(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingCSVWithHeader, GetDefCSVWithHeader()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -783,15 +786,15 @@ bool VCommonSettings::GetDefCSVWithHeader() //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetCSVCodec(int mib) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - settings.setValue(settingCSVCodec, mib); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingCSVCodec, mib); } //--------------------------------------------------------------------------------------------------------------------- int VCommonSettings::GetCSVCodec() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - return settings.value(settingCSVCodec, GetDefCSVCodec()).toInt(); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingCSVCodec, GetDefCSVCodec()).toInt(); } //--------------------------------------------------------------------------------------------------------------------- @@ -803,20 +806,20 @@ int VCommonSettings::GetDefCSVCodec() //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetCSVSeparator(const QChar &separator) { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); switch(separator.toLatin1()) { case '\t': - settings.setValue(settingCSVSeparator, 0); + settings.setValue(*settingCSVSeparator, 0); break; case ';': - settings.setValue(settingCSVSeparator, 1); + settings.setValue(*settingCSVSeparator, 1); break; case ' ': - settings.setValue(settingCSVSeparator, 2); + settings.setValue(*settingCSVSeparator, 2); break; default: - settings.setValue(settingCSVSeparator, 3); + settings.setValue(*settingCSVSeparator, 3); break; } } @@ -824,8 +827,8 @@ void VCommonSettings::SetCSVSeparator(const QChar &separator) //--------------------------------------------------------------------------------------------------------------------- QChar VCommonSettings::GetCSVSeparator() const { - QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename); - const quint8 separator = static_cast(settings.value(settingCSVSeparator, 3).toUInt()); + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + const quint8 separator = static_cast(settings.value(*settingCSVSeparator, 3).toUInt()); switch(separator) { case 0: @@ -848,7 +851,7 @@ QChar VCommonSettings::GetDefCSVSeparator() //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetDefaultSeamAllowance(double value) { - setValue(settingPatternDefaultSeamAllowance, UnitConvertor(value, StrToUnits(GetUnit()), Unit::Cm)); + setValue(*settingPatternDefaultSeamAllowance, UnitConvertor(value, StrToUnits(GetUnit()), Unit::Cm)); } //--------------------------------------------------------------------------------------------------------------------- @@ -877,10 +880,10 @@ double VCommonSettings::GetDefaultSeamAllowance() } bool ok = false; - double val = value(settingPatternDefaultSeamAllowance, -1).toDouble(&ok); + double val = value(*settingPatternDefaultSeamAllowance, -1).toDouble(&ok); if (ok == false) { - qDebug()<< "Could not convert value"<(value(settingPatternLabelFont, QApplication::font())); + return qvariant_cast(value(*settingPatternLabelFont, QApplication::font())); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetLabelFont(const QFont &f) { - setValue(settingPatternLabelFont, f); + setValue(*settingPatternLabelFont, f); } //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetLabelDateFormat() const { - const QString format = value(settingLabelDateFormat, VCommonSettings::PredefinedDateFormats().first()).toString(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + const QString format = value(*settingLabelDateFormat, + VCommonSettings::PredefinedDateFormats().constFirst()).toString(); +#else + const QString format = value(*settingLabelDateFormat, VCommonSettings::PredefinedDateFormats().first()).toString(); // clazy:exclude=detaching-temporary +#endif const QStringList allFormats = VCommonSettings::PredefinedDateFormats() + GetUserDefinedDateFormats(); if (allFormats.contains(format)) @@ -922,14 +930,18 @@ QString VCommonSettings::GetLabelDateFormat() const } else { - return VCommonSettings::PredefinedDateFormats().first(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return VCommonSettings::PredefinedDateFormats().constFirst(); +#else + return VCommonSettings::PredefinedDateFormats().first(); // clazy:exclude=detaching-temporary +#endif } } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetLabelDateFormat(const QString &format) { - setValue(settingLabelDateFormat, format); + setValue(*settingLabelDateFormat, format); } //--------------------------------------------------------------------------------------------------------------------- @@ -961,19 +973,24 @@ QStringList VCommonSettings::PredefinedDateFormats() //--------------------------------------------------------------------------------------------------------------------- QStringList VCommonSettings::GetUserDefinedDateFormats() const { - return value(settingLabelUserDateFormats, QStringList()).toStringList(); + return value(*settingLabelUserDateFormats, QStringList()).toStringList(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetUserDefinedDateFormats(const QStringList &formats) { - setValue(settingLabelUserDateFormats, ClearFormats(VCommonSettings::PredefinedDateFormats(), formats)); + setValue(*settingLabelUserDateFormats, ClearFormats(VCommonSettings::PredefinedDateFormats(), formats)); } //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetLabelTimeFormat() const { - const QString format = value(settingLabelTimeFormat, VCommonSettings::PredefinedTimeFormats().first()).toString(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + const QString format = value(*settingLabelTimeFormat, + VCommonSettings::PredefinedTimeFormats().constFirst()).toString(); +#else + const QString format = value(*settingLabelTimeFormat, VCommonSettings::PredefinedTimeFormats().first()).toString(); // clazy:exclude=detaching-temporary +#endif const QStringList allFormats = VCommonSettings::PredefinedTimeFormats() + GetUserDefinedTimeFormats(); if (allFormats.contains(format)) @@ -982,14 +999,18 @@ QString VCommonSettings::GetLabelTimeFormat() const } else { - return VCommonSettings::PredefinedTimeFormats().first(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + return VCommonSettings::PredefinedTimeFormats().constFirst(); +#else + return VCommonSettings::PredefinedTimeFormats().first(); // clazy:exclude=detaching-temporary +#endif } } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetLabelTimeFormat(const QString &format) { - setValue(settingLabelTimeFormat, format); + setValue(*settingLabelTimeFormat, format); } //--------------------------------------------------------------------------------------------------------------------- @@ -1005,13 +1026,13 @@ QStringList VCommonSettings::PredefinedTimeFormats() //--------------------------------------------------------------------------------------------------------------------- QStringList VCommonSettings::GetUserDefinedTimeFormats() const { - return value(settingLabelUserTimeFormats, QStringList()).toStringList(); + return value(*settingLabelUserTimeFormats, QStringList()).toStringList(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetUserDefinedTimeFormats(const QStringList &formats) { - setValue(settingLabelUserTimeFormats, ClearFormats(VCommonSettings::PredefinedTimeFormats(), formats)); + setValue(*settingLabelUserTimeFormats, ClearFormats(VCommonSettings::PredefinedTimeFormats(), formats)); } //--------------------------------------------------------------------------------------------------------------------- @@ -1020,7 +1041,7 @@ qreal VCommonSettings::GetCurveApproximationScale() const if (curveApproximationCached < 0) { bool ok = false; - const qreal scale = value(settingPatternCurveApproximationScale, defCurveApproximationScale).toDouble(&ok); + const qreal scale = value(*settingPatternCurveApproximationScale, defCurveApproximationScale).toDouble(&ok); if (ok && scale >= minCurveApproximationScale && scale <= maxCurveApproximationScale) { curveApproximationCached = scale; @@ -1039,7 +1060,7 @@ void VCommonSettings::SetCurveApproximationScale(qreal value) { if (value >= minCurveApproximationScale && value <= maxCurveApproximationScale) { - setValue(settingPatternCurveApproximationScale, value); + setValue(*settingPatternCurveApproximationScale, value); curveApproximationCached = value; } } @@ -1047,13 +1068,13 @@ void VCommonSettings::SetCurveApproximationScale(qreal value) //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::IsShowCurveDetails() const { - return value(settingPatternShowCurveDetails, false).toBool(); + return value(*settingPatternShowCurveDetails, false).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetShowCurveDetails(bool value) { - setValue(settingPatternShowCurveDetails, value); + setValue(*settingPatternShowCurveDetails, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -1061,7 +1082,7 @@ qreal VCommonSettings::GetLineWidth() const { if (lineWidthCached <= 0) { - lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), value(settingPatternLineWidth, 1.2).toDouble(), + lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), value(*settingPatternLineWidth, 1.2).toDouble(), VCommonSettings::MaximalLineWidth()); } @@ -1072,7 +1093,7 @@ qreal VCommonSettings::GetLineWidth() const void VCommonSettings::SetLineWidth(qreal width) { lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), width, VCommonSettings::MaximalLineWidth()); - setValue(settingPatternLineWidth, lineWidthCached); + setValue(*settingPatternLineWidth, lineWidthCached); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vmisc/vsettings.cpp b/src/libs/vmisc/vsettings.cpp index 4130d9321..eef22261e 100644 --- a/src/libs/vmisc/vsettings.cpp +++ b/src/libs/vmisc/vsettings.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "../vmisc/def.h" #include "../vmisc/vmath.h" @@ -47,36 +48,37 @@ Q_DECLARE_METATYPE(QMarginsF) namespace { -const QString settingConfigurationLabelLanguage = QStringLiteral("configuration/label_language"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage, + (QLatin1String("configuration/label_language"))) -const QString settingPathsPattern = QStringLiteral("paths/pattern"); -const QString settingPathsLayout = QStringLiteral("paths/layout"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout"))) -const QString settingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput"); -const QString settingPatternUseOpenGLRender = QStringLiteral("pattern/useOpenGLRender"); -const QString settingPatternKnownMaterials = QStringLiteral("pattern/knownMaterials"); -const QString settingPatternRememberMaterials = QStringLiteral("pattern/rememberMaterials"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials"))) -const QString settingLayoutWidth = QStringLiteral("layout/width"); -const QString settingLayoutSorting = QStringLiteral("layout/sorting"); -const QString settingLayoutPaperHeight = QStringLiteral("layout/paperHeight"); -const QString settingLayoutPaperWidth = QStringLiteral("layout/paperWidth"); -const QString settingLayoutShift = QStringLiteral("layout/shift"); -const QString settingLayoutRotate = QStringLiteral("layout/Rotate"); -const QString settingLayoutRotationIncrease = QStringLiteral("layout/rotationIncrease"); -const QString settingLayoutAutoCrop = QStringLiteral("layout/autoCrop"); -const QString settingLayoutSaveLength = QStringLiteral("layout/saveLength"); -const QString settingLayoutUnitePages = QStringLiteral("layout/unitePages"); -const QString settingFields = QStringLiteral("layout/fields"); -const QString settingIgnoreFields = QStringLiteral("layout/ignoreFields"); -const QString settingStripOptimization = QStringLiteral("layout/stripOptimization"); -const QString settingMultiplier = QStringLiteral("layout/multiplier"); -const QString settingTextAsPaths = QStringLiteral("layout/textAsPaths"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShift, (QLatin1String("layout/shift"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutRotate, (QLatin1String("layout/Rotate"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutRotationIncrease, (QLatin1String("layout/rotationIncrease"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCrop, (QLatin1String("layout/autoCrop"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, (QLatin1String("layout/multiplier"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, (QLatin1String("layout/textAsPaths"))) -const QString settingTiledPDFMargins = QStringLiteral("tiledPDF/margins"); -const QString settingTiledPDFPaperHeight = QStringLiteral("tiledPDF/paperHeight"); -const QString settingTiledPDFPaperWidth = QStringLiteral("tiledPDF/paperWidth"); -const QString settingTiledPDFOrientation = QStringLiteral("tiledPDF/orientation"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String("tiledPDF/margins"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation"))) } //--------------------------------------------------------------------------------------------------------------------- @@ -90,13 +92,13 @@ VSettings::VSettings(Format format, Scope scope, const QString &organization, co //--------------------------------------------------------------------------------------------------------------------- QString VSettings::GetLabelLanguage() const { - return value(settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString(); + return value(*settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLabelLanguage(const QString &value) { - setValue(settingConfigurationLabelLanguage, value); + setValue(*settingConfigurationLabelLanguage, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -109,14 +111,14 @@ QString VSettings::GetDefPathPattern() QString VSettings::GetPathPattern() const { QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); - return settings.value(settingPathsPattern, GetDefPathPattern()).toString(); + return settings.value(*settingPathsPattern, GetDefPathPattern()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetPathPattern(const QString &value) { QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); - settings.setValue(settingPathsPattern, value); + settings.setValue(*settingPathsPattern, value); settings.sync(); } @@ -130,39 +132,39 @@ QString VSettings::GetDefPathLayout() QString VSettings::GetPathLayout() const { QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); - return settings.value(settingPathsLayout, GetDefPathLayout()).toString(); + return settings.value(*settingPathsLayout, GetDefPathLayout()).toString(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetPathLayout(const QString &value) { QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); - settings.setValue(settingPathsLayout, value); + settings.setValue(*settingPathsLayout, value); settings.sync(); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetGraphicalOutput() const { - return value(settingPatternGraphicalOutput, 1).toBool(); + return value(*settingPatternGraphicalOutput, 1).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetGraphicalOutput(const bool &value) { - setValue(settingPatternGraphicalOutput, value); + setValue(*settingPatternGraphicalOutput, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::IsOpenGLRender() const { - return value(settingPatternUseOpenGLRender, 0).toBool(); + return value(*settingPatternUseOpenGLRender, 0).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetOpenGLRender(bool value) { - setValue(settingPatternUseOpenGLRender, value); + setValue(*settingPatternUseOpenGLRender, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -170,7 +172,7 @@ qreal VSettings::GetLayoutPaperHeight() const { const qreal def = UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px); bool ok = false; - const qreal height = value(settingLayoutPaperHeight, def).toDouble(&ok); + const qreal height = value(*settingLayoutPaperHeight, def).toDouble(&ok); if (ok) { return height; @@ -184,7 +186,7 @@ qreal VSettings::GetLayoutPaperHeight() const //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutPaperHeight(qreal value) { - setValue(settingLayoutPaperHeight, value); + setValue(*settingLayoutPaperHeight, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -192,7 +194,7 @@ qreal VSettings::GetLayoutPaperWidth() const { const qreal def = UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px); bool ok = false; - const qreal width = value(settingLayoutPaperWidth, def).toDouble(&ok); + const qreal width = value(*settingLayoutPaperWidth, def).toDouble(&ok); if (ok) { return width; @@ -206,7 +208,7 @@ qreal VSettings::GetLayoutPaperWidth() const //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutPaperWidth(qreal value) { - setValue(settingLayoutPaperWidth, value); + setValue(*settingLayoutPaperWidth, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -214,7 +216,7 @@ qreal VSettings::GetLayoutShift() const { const qreal def = GetDefLayoutShift(); bool ok = false; - const qreal shift = value(settingLayoutShift, def).toDouble(&ok); + const qreal shift = value(*settingLayoutShift, def).toDouble(&ok); if (ok) { return shift; @@ -234,7 +236,7 @@ qreal VSettings::GetDefLayoutShift() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutShift(qreal value) { - setValue(settingLayoutShift, value); + setValue(*settingLayoutShift, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -242,7 +244,7 @@ qreal VSettings::GetLayoutWidth() const { const qreal def = GetDefLayoutWidth(); bool ok = false; - const qreal lWidth = value(settingLayoutWidth, def).toDouble(&ok); + const qreal lWidth = value(*settingLayoutWidth, def).toDouble(&ok); if (ok) { return lWidth; @@ -262,13 +264,13 @@ qreal VSettings::GetDefLayoutWidth() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutWidth(qreal value) { - setValue(settingLayoutWidth, value); + setValue(*settingLayoutWidth, value); } //--------------------------------------------------------------------------------------------------------------------- QMarginsF VSettings::GetFields(const QMarginsF &def) const { - const QVariant val = value(settingFields, QVariant::fromValue(def)); + const QVariant val = value(*settingFields, QVariant::fromValue(def)); if (val.canConvert()) { return val.value(); @@ -279,7 +281,7 @@ QMarginsF VSettings::GetFields(const QMarginsF &def) const //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetFields(const QMarginsF &value) { - setValue(settingFields, QVariant::fromValue(value)); + setValue(*settingFields, QVariant::fromValue(value)); } //--------------------------------------------------------------------------------------------------------------------- @@ -287,7 +289,7 @@ Cases VSettings::GetLayoutGroup() const { const Cases def = GetDefLayoutGroup(); bool ok = false; - const int g = value(settingLayoutSorting, static_cast(def)).toInt(&ok); + const int g = value(*settingLayoutSorting, static_cast(def)).toInt(&ok); if (ok) { if (g >= static_cast(Cases::UnknownCase)) @@ -314,13 +316,13 @@ Cases VSettings::GetDefLayoutGroup() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutGroup(const Cases &value) { - setValue(settingLayoutSorting, static_cast(value)); + setValue(*settingLayoutSorting, static_cast(value)); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetLayoutRotate() const { - return value(settingLayoutRotate, GetDefLayoutRotate()).toBool(); + return value(*settingLayoutRotate, GetDefLayoutRotate()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -332,7 +334,7 @@ bool VSettings::GetDefLayoutRotate() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutRotate(bool value) { - setValue(settingLayoutRotate, value); + setValue(*settingLayoutRotate, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -340,7 +342,7 @@ int VSettings::GetLayoutRotationIncrease() const { const int def = GetDefLayoutRotationIncrease(); bool ok = false; - const int r = value(settingLayoutRotationIncrease, def).toInt(&ok); + const int r = value(*settingLayoutRotationIncrease, def).toInt(&ok); if (ok) { if (not (r >= 1 && r <= 180 && 360 % r == 0)) @@ -367,13 +369,13 @@ int VSettings::GetDefLayoutRotationIncrease() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutRotationIncrease(int value) { - setValue(settingLayoutRotationIncrease, value); + setValue(*settingLayoutRotationIncrease, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetLayoutAutoCrop() const { - return value(settingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool(); + return value(*settingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -385,13 +387,13 @@ bool VSettings::GetDefLayoutAutoCrop() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutAutoCrop(bool value) { - setValue(settingLayoutAutoCrop, value); + setValue(*settingLayoutAutoCrop, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetLayoutSaveLength() const { - return value(settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool(); + return value(*settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -403,13 +405,13 @@ bool VSettings::GetDefLayoutSaveLength() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutSaveLength(bool value) { - setValue(settingLayoutSaveLength, value); + setValue(*settingLayoutSaveLength, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetLayoutUnitePages() const { - return value(settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool(); + return value(*settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -421,13 +423,13 @@ bool VSettings::GetDefLayoutUnitePages() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetLayoutUnitePages(bool value) { - setValue(settingLayoutUnitePages, value); + setValue(*settingLayoutUnitePages, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetIgnoreAllFields() const { - return value(settingIgnoreFields, GetDefIgnoreAllFields()).toBool(); + return value(*settingIgnoreFields, GetDefIgnoreAllFields()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -439,13 +441,13 @@ bool VSettings::GetDefIgnoreAllFields() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetIgnoreAllFields(bool value) { - setValue(settingIgnoreFields, value); + setValue(*settingIgnoreFields, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetStripOptimization() const { - return value(settingStripOptimization, GetDefStripOptimization()).toBool(); + return value(*settingStripOptimization, GetDefStripOptimization()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -457,13 +459,13 @@ bool VSettings::GetDefStripOptimization() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetStripOptimization(bool value) { - setValue(settingStripOptimization, value); + setValue(*settingStripOptimization, value); } //--------------------------------------------------------------------------------------------------------------------- quint8 VSettings::GetMultiplier() const { - return static_cast(value(settingMultiplier, GetDefMultiplier()).toUInt()); + return static_cast(value(*settingMultiplier, GetDefMultiplier()).toUInt()); } //--------------------------------------------------------------------------------------------------------------------- @@ -475,13 +477,13 @@ quint8 VSettings::GetDefMultiplier() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetMultiplier(quint8 value) { - setValue(settingMultiplier, value); + setValue(*settingMultiplier, value); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetTextAsPaths() const { - return value(settingTextAsPaths, GetDefTextAsPaths()).toBool(); + return value(*settingTextAsPaths, GetDefTextAsPaths()).toBool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -493,31 +495,31 @@ bool VSettings::GetDefTextAsPaths() //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetTextAsPaths(bool value) { - setValue(settingTextAsPaths, value); + setValue(*settingTextAsPaths, value); } //--------------------------------------------------------------------------------------------------------------------- QStringList VSettings::GetKnownMaterials() const { - return value(settingPatternKnownMaterials, QStringList()).toStringList(); + return value(*settingPatternKnownMaterials, QStringList()).toStringList(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetKnownMaterials(const QStringList &list) { - setValue(settingPatternKnownMaterials, list); + setValue(*settingPatternKnownMaterials, list); } //--------------------------------------------------------------------------------------------------------------------- bool VSettings::IsRememberPatternMaterials() const { - return value(settingPatternRememberMaterials, true).toBool(); + return value(*settingPatternRememberMaterials, true).toBool(); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetRememberPatternMaterials(bool value) { - setValue(settingPatternRememberMaterials, value); + setValue(*settingPatternRememberMaterials, value); } // settings for the tiled PDFs @@ -534,7 +536,7 @@ QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const // default value is 10mm. We save the margins in mm in the setting. const QMarginsF def = QMarginsF(10, 10, 10, 10); - const QVariant val = value(settingTiledPDFMargins, QVariant::fromValue(def)); + const QVariant val = value(*settingTiledPDFMargins, QVariant::fromValue(def)); if (val.canConvert()) { @@ -552,7 +554,7 @@ QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const */ void VSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &unit) { - setValue(settingTiledPDFMargins, QVariant::fromValue(UnitConvertor(value, unit, Unit::Mm))); + setValue(*settingTiledPDFMargins, QVariant::fromValue(UnitConvertor(value, unit, Unit::Mm))); } //--------------------------------------------------------------------------------------------------------------------- @@ -566,7 +568,7 @@ qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const { const qreal def = 297 /*A4*/; bool ok = false; - const qreal height = value(settingTiledPDFPaperHeight, def).toDouble(&ok); + const qreal height = value(*settingTiledPDFPaperHeight, def).toDouble(&ok); if (ok) { return UnitConvertor(height, Unit::Mm, unit); @@ -585,7 +587,7 @@ qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const */ void VSettings::SetTiledPDFPaperHeight(qreal value, const Unit &unit) { - setValue(settingTiledPDFPaperHeight, UnitConvertor(value, unit, Unit::Mm)); + setValue(*settingTiledPDFPaperHeight, UnitConvertor(value, unit, Unit::Mm)); } //--------------------------------------------------------------------------------------------------------------------- @@ -600,7 +602,7 @@ qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const const qreal def = 210 /*A4*/; bool ok = false; - const qreal width = value(settingTiledPDFPaperWidth, def).toDouble(&ok); + const qreal width = value(*settingTiledPDFPaperWidth, def).toDouble(&ok); if (ok) { return UnitConvertor(width, Unit::Mm, unit); @@ -619,20 +621,20 @@ qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const */ void VSettings::SetTiledPDFPaperWidth(qreal value, const Unit &unit) { - setValue(settingTiledPDFPaperWidth, UnitConvertor(value,unit, Unit::Mm)); + setValue(*settingTiledPDFPaperWidth, UnitConvertor(value,unit, Unit::Mm)); } //--------------------------------------------------------------------------------------------------------------------- PageOrientation VSettings::GetTiledPDFOrientation() const { bool defaultValue = static_cast(PageOrientation::Portrait); - bool result = value(settingTiledPDFOrientation, defaultValue).toBool(); + bool result = value(*settingTiledPDFOrientation, defaultValue).toBool(); return static_cast(result); } //--------------------------------------------------------------------------------------------------------------------- void VSettings::SetTiledPDFOrientation(PageOrientation value) { - setValue(settingTiledPDFOrientation, static_cast (value)); + setValue(*settingTiledPDFOrientation, static_cast (value)); } diff --git a/src/libs/vmisc/vtapesettings.cpp b/src/libs/vmisc/vtapesettings.cpp index 7817f8e4a..5a4efeb8b 100644 --- a/src/libs/vmisc/vtapesettings.cpp +++ b/src/libs/vmisc/vtapesettings.cpp @@ -32,11 +32,15 @@ #include #include #include +#include -const QString settingDataBaseGeometry = QStringLiteral("database/geometry"); +namespace +{ +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, (QLatin1String("database/geometry"))) -const QString settingDefHeight = QStringLiteral("gradation/defHeight"); -const QString settingDefSize = QStringLiteral("gradation/defSize"); +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefHeight, (QLatin1String("gradation/defHeight"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefSize, (QLatin1String("gradation/defSize"))) +} //--------------------------------------------------------------------------------------------------------------------- VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application, @@ -48,35 +52,35 @@ VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organiza //--------------------------------------------------------------------------------------------------------------------- QByteArray VTapeSettings::GetDataBaseGeometry() const { - return value(settingDataBaseGeometry).toByteArray(); + return value(*settingDataBaseGeometry).toByteArray(); } //--------------------------------------------------------------------------------------------------------------------- void VTapeSettings::SetDataBaseGeometry(const QByteArray &value) { - setValue(settingDataBaseGeometry, value); + setValue(*settingDataBaseGeometry, value); } //--------------------------------------------------------------------------------------------------------------------- void VTapeSettings::SetDefHeight(int value) { - setValue(settingDefHeight, value); + setValue(*settingDefHeight, value); } //--------------------------------------------------------------------------------------------------------------------- int VTapeSettings::GetDefHeight() const { - return value(settingDefHeight, 176).toInt(); + return value(*settingDefHeight, 176).toInt(); } //--------------------------------------------------------------------------------------------------------------------- void VTapeSettings::SetDefSize(int value) { - setValue(settingDefSize, value); + setValue(*settingDefSize, value); } //--------------------------------------------------------------------------------------------------------------------- int VTapeSettings::GetDefSize() const { - return value(settingDefSize, 50).toInt(); + return value(*settingDefSize, 50).toInt(); } diff --git a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp index 75a28482d..e335f048f 100644 --- a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp @@ -213,11 +213,13 @@ bool VPE::VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) c QList tmpUrlList = data->urls(); QFileInfo tmpFileInfo; - foreach(QUrl tmpUrl, tmpUrlList) + for(const QUrl &tmpUrl : tmpUrlList) + { if (QFile::exists(tmpUrl.toLocalFile())) { tmpFileInfo = QFileInfo(tmpUrl.toLocalFile()); break; } + } if (checkFileFilter(tmpFileInfo.fileName())) { diff --git a/src/libs/vpropertyexplorer/vpropertymodel.cpp b/src/libs/vpropertyexplorer/vpropertymodel.cpp index 04eb66d7a..e9792dbdf 100644 --- a/src/libs/vpropertyexplorer/vpropertymodel.cpp +++ b/src/libs/vpropertyexplorer/vpropertymodel.cpp @@ -319,12 +319,12 @@ VPE::VPropertySet *VPE::VPropertyModel::takePropertySet(VPropertySet *new_proper if (emit_signals) { - emit beginResetModel(); + beginResetModel(); } d_ptr->Properties = new_property_set; if (emit_signals) { - emit endResetModel(); + endResetModel(); } return tmpOldPropertySet; diff --git a/src/libs/vtest/abstracttest.cpp b/src/libs/vtest/abstracttest.cpp index 8e2387545..81560bf62 100644 --- a/src/libs/vtest/abstracttest.cpp +++ b/src/libs/vtest/abstracttest.cpp @@ -105,7 +105,7 @@ QString AbstractTest::TranslationsPath() const //--------------------------------------------------------------------------------------------------------------------- int AbstractTest::Run(int exit, const QString &program, const QStringList &arguments, QString &error, int msecs) { - const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program).arg(arguments.join(", ")); + const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program, arguments.join(", ")); QFileInfo info(program); if (not info.exists()) @@ -134,7 +134,7 @@ int AbstractTest::Run(int exit, const QString &program, const QStringList &argum if (process->exitStatus() == QProcess::CrashExit) { - error = QString("Program crashed.\n%1\n%2").arg(parameters).arg(QString(process->readAllStandardError())); + error = QString("Program crashed.\n%1\n%2").arg(parameters, QString(process->readAllStandardError())); return TST_EX_CRASH; } @@ -177,7 +177,7 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg } else { - if (QFileInfo(tgtFilePath).exists()) + if (QFileInfo::exists(tgtFilePath)) { const QString msg = QString("File '%1' exists.").arg(srcFilePath); QWARN(qUtf8Printable(msg)); @@ -197,7 +197,7 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg QFile srcFile(srcFilePath); if (not srcFile.open(QFile::ReadOnly)) { - const QString msg = QString("Can't copy file '%1'. Error: %2").arg(srcFilePath).arg(srcFile.errorString()); + const QString msg = QString("Can't copy file '%1'. Error: %2").arg(srcFilePath, srcFile.errorString()); QWARN(qUtf8Printable(msg)); return false; } @@ -205,8 +205,8 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg if (not srcFile.copy(tgtFilePath)) { - const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3").arg(srcFilePath).arg(tgtFilePath) - .arg(srcFile.errorString()); + const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3") + .arg(srcFilePath, tgtFilePath, srcFile.errorString()); QWARN(qUtf8Printable(msg)); return false; } diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index c30e988f4..4f227c6ef 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -134,14 +134,14 @@ void DialogEditWrongFormula::DialogAccepted() { formula = ui->plainTextEditFormula->toPlainText(); emit DialogClosed(QDialog::Accepted); - accepted(); + emit accepted(); } //--------------------------------------------------------------------------------------------------------------------- void DialogEditWrongFormula::DialogRejected() { emit DialogClosed(QDialog::Rejected); - rejected(); + emit rejected(); } //--------------------------------------------------------------------------------------------------------------------- @@ -492,7 +492,7 @@ void DialogEditWrongFormula::InitVariables() void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, const QString &unit, const QString &description) { - const QString desc = QString("%1(%2 %3) - %4").arg(name).arg(value).arg(unit).arg(description); + const QString desc = QString("%1(%2 %3) - %4").arg(name).arg(value).arg(unit, description); ui->labelDescription->setText(desc); } @@ -592,8 +592,9 @@ void DialogEditWrongFormula::ShowFunctions() ui->tableWidget->setColumnHidden(ColumnFullName, true); ui->labelDescription->setText(""); - QMap::const_iterator i = qApp->TrVars()->GetFunctions().constBegin(); - while (i != qApp->TrVars()->GetFunctions().constEnd()) + const QMap functions = qApp->TrVars()->GetFunctions(); + QMap::const_iterator i = functions.constBegin(); + while (i != functions.constEnd()) { ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1); QTableWidgetItem *item = new QTableWidgetItem(i.value().translate(qApp->Settings()->GetLocale())); @@ -653,7 +654,8 @@ void DialogEditWrongFormula::FilterVariablesEdited(const QString &filter) } // show rows with matched filter - for (auto item : ui->tableWidget->findItems(filter, Qt::MatchContains)) + const QList items = ui->tableWidget->findItems(filter, Qt::MatchContains); + for (auto item : items) { // If filter is empty findItems() for unknown reason returns nullptr items. if (item) diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index fa8af20d8..0862f85d2 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -843,8 +843,7 @@ void DialogPiecePath::InitPathTab() connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogPiecePath::NameChanged); InitPathTypes(); - connect(ui->comboBoxType, QOverload::of(&QComboBox::currentIndexChanged), - [this]() + connect(ui->comboBoxType, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { ui->comboBoxPenType->setEnabled(GetType() == PiecePathType::InternalPath); ui->checkBoxCut->setEnabled(GetType() == PiecePathType::InternalPath); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp index db4dd25eb..bb1b11022 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -236,8 +236,7 @@ void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer QString VToolFlippingByAxis::MakeToolTip() const { const QString toolTip = QString(" %1: %2 ") - .arg(tr("Origin point")) - .arg(OriginPointName()); + .arg(tr("Origin point"), OriginPointName()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index c953fd890..7167e607e 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -224,10 +224,7 @@ QString VToolFlippingByLine::MakeToolTip() const { const QString toolTip = QString(" %1: %2 " " %3: %4 ") - .arg(tr("First line point")) - .arg(FirstLinePointName()) - .arg(tr("Second line point")) - .arg(SecondLinePointName()); + .arg(tr("First line point"), FirstLinePointName(), tr("Second line point"), SecondLinePointName()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp index 89f94ae02..ce40b422b 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp @@ -689,11 +689,8 @@ QString VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const " %3: %4 %5 " "%6" "") - .arg(tr("Label")) - .arg(curve->name()) - .arg(tr("Length")) + .arg(tr("Label"), curve->name(), tr("Length")) .arg(qApp->fromPixel(curve->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(MakeToolTip()); + .arg(UnitsToStr(qApp->patternUnit(), true), MakeToolTip()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index ed9a1e454..6f4d388a5 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -514,11 +514,11 @@ QString VToolMove::MakeToolTip() const .arg(GetFormulaAngle().getDoubleValue()) // 2 .arg(tr("Length")) // 3 .arg(GetFormulaLength().getDoubleValue()) // 4 - .arg(UnitsToStr(qApp->patternUnit(), true)) // 5 - .arg(tr("Rotation angle")) // 6 + .arg(UnitsToStr(qApp->patternUnit(), true), // 5 + tr("Rotation angle")) // 6 .arg(GetFormulaRotationAngle().getDoubleValue()) // 7 - .arg(tr("Rotation origin point")) // 8 - .arg(OriginPointName()); // 9 + .arg(tr("Rotation origin point"), // 8 + OriginPointName()); // 9 return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index 17df79122..a96a8f83f 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -374,9 +374,7 @@ QString VToolRotation::MakeToolTip() const { const QString toolTip = QString(" %1: %2 " " %3: %4° ") - .arg(tr("Origin point")) - .arg(OriginPointName()) - .arg(tr("Rotation angle")) + .arg(tr("Origin point"), OriginPointName(), tr("Rotation angle")) .arg(GetFormulaAngle().getDoubleValue()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index b883b080b..e0d011c2f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -202,9 +202,7 @@ QString VAbstractSpline::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curve->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Label")) - .arg(curve->name()); + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Label"), curve->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 63adc9481..4c28c5f46 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -387,14 +387,12 @@ QString VToolArc::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(arc->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Radius")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius")) .arg(qApp->fromPixel(arc->GetRadius())) .arg(tr("Start angle")) .arg(qApp->fromPixel(arc->GetStartAngle())) .arg(tr("End angle")) .arg(qApp->fromPixel(arc->GetEndAngle())) - .arg(tr("Label")) - .arg(arc->name()); + .arg(tr("Label"), arc->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 290cef254..517750d1d 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -365,14 +365,12 @@ QString VToolArcWithLength::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(arc->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Radius")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius")) .arg(qApp->fromPixel(arc->GetRadius())) .arg(tr("Start angle")) .arg(qApp->fromPixel(arc->GetStartAngle())) .arg(tr("End angle")) .arg(qApp->fromPixel(arc->GetEndAngle())) - .arg(tr("Label")) - .arg(arc->name()); + .arg(tr("Label"), arc->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp index faedc812c..3da1b75dd 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -440,8 +440,8 @@ QString VToolEllipticalArc::MakeToolTip() const "") .arg(tr("Length")) // 1 .arg(qApp->fromPixel(elArc->GetLength())) // 2 - .arg(UnitsToStr(qApp->patternUnit(), true)) // 3 - .arg(tr("Radius") + QLatin1String("1")) // 4 + .arg(UnitsToStr(qApp->patternUnit(), true), // 3 + tr("Radius") + QLatin1String("1")) // 4 .arg(qApp->fromPixel(elArc->GetRadius1())) // 5 .arg(tr("Radius") + QLatin1String("2")) // 6 .arg(qApp->fromPixel(elArc->GetRadius2())) // 7 @@ -449,9 +449,9 @@ QString VToolEllipticalArc::MakeToolTip() const .arg(elArc->GetStartAngle()) // 9 .arg(tr("End angle")) // 10 .arg(elArc->GetEndAngle()) // 11 - .arg(tr("Label")) // 12 - .arg(elArc->name()) // 13 - .arg(tr("Rotation")) // 14 + .arg(tr("Label"), // 12 + elArc->name(), // 13 + tr("Rotation")) // 14 .arg(elArc->GetRotationAngle()); // 15 return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index faf490820..5e28b5b48 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -273,15 +273,13 @@ QString VToolCutArc::MakeToolTip() const " %8: %9° ") .arg(arcStr + arcNumber + QLatin1String(" ") + lengthStr) .arg(qApp->fromPixel(arc.GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(arcStr + arcNumber + QLatin1String(" ") + radiusStr) + .arg(UnitsToStr(qApp->patternUnit(), true), arcStr + arcNumber + QLatin1String(" ") + radiusStr) .arg(qApp->fromPixel(arc.GetRadius())) .arg(arcStr + arcNumber + QLatin1String(" ") + startAngleStr) .arg(qApp->fromPixel(arc.GetStartAngle())) .arg(arcStr + arcNumber + QLatin1String(" ") + endAngleStr) .arg(qApp->fromPixel(arc.GetEndAngle())) - .arg(arcStr + arcNumber + QLatin1String(" ") + tr("label")) - .arg(arc.name()); + .arg(arcStr + arcNumber + QLatin1String(" ") + tr("label"), arc.name()); return toolTip; }; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 91c4866b1..4b08a94f4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -269,13 +269,10 @@ QString VToolCutSpline::MakeToolTip() const "") .arg(curveStr + QLatin1String("1 ") + lengthStr) .arg(qApp->fromPixel(spline1.GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(curveStr + QLatin1String("2 ") + lengthStr) + .arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr) .arg(qApp->fromPixel(spline2.GetLength())) - .arg(curveStr + QLatin1String(" 1") + tr("label")) - .arg(spline1.name()) - .arg(curveStr + QLatin1String(" 2") + tr("label")) - .arg(spline2.name()); + .arg(curveStr + QLatin1String(" 1") + tr("label"), spline1.name(), + curveStr + QLatin1String(" 2") + tr("label"), spline2.name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 399096692..5e0c0db1b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -359,13 +359,10 @@ QString VToolCutSplinePath::MakeToolTip() const "") .arg(curveStr + QLatin1String("1 ") + lengthStr) .arg(qApp->fromPixel(splPath1->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(curveStr + QLatin1String("2 ") + lengthStr) + .arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr) .arg(qApp->fromPixel(splPath2->GetLength())) - .arg(curveStr + QLatin1String(" 1") + tr("label")) - .arg(splPath1->name()) - .arg(curveStr + QLatin1String(" 2") + tr("label")) - .arg(splPath2->name()); + .arg(curveStr + QLatin1String(" 1") + tr("label"), splPath1->name(), + curveStr + QLatin1String(" 2") + tr("label"), splPath2->name()); delete splPath1; delete splPath2; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 54a89c331..bf9e6d9ff 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -162,14 +162,12 @@ QString VToolAlongLine::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curLine.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Angle")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) .arg(curLine.angle()) - .arg(QString("%1->%2").arg(basePoint->name(), current->name())) - .arg(QString("%1->%2").arg(current->name(), secondPoint->name())) + .arg(QString("%1->%2").arg(basePoint->name(), current->name()), + QString("%1->%2").arg(current->name(), secondPoint->name())) .arg(qApp->fromPixel(curToSecond.length())) - .arg(tr("Label")) - .arg(current->name()); + .arg(tr("Label"), current->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index a34c1c3c6..505f6fe79 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -281,15 +281,13 @@ QString VToolHeight::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curLine.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Angle")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) .arg(curLine.angle()) .arg(QString("%1->%2").arg(p1Line->name(), current->name())) .arg(qApp->fromPixel(p1ToCur.length())) .arg(QString("%1->%2").arg(p2Line->name(), current->name())) .arg(qApp->fromPixel(p2ToCur.length())) - .arg(tr("Label")) - .arg(current->name()); + .arg(tr("Label"), current->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 81309b613..3176e4c2d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -326,14 +326,12 @@ QString VToolLineIntersectAxis::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curLine.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Angle")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) .arg(curLine.angle()) .arg(QString("%1->%2").arg(firstPoint->name(), current->name())) .arg(qApp->fromPixel(firstToCur.length())) .arg(QString("%1->%2").arg(current->name(), secondPoint->name())) .arg(qApp->fromPixel(curToSecond.length())) - .arg(tr("Label")) - .arg(current->name()); + .arg(tr("Label"), current->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp index d7b2f2b92..4df819207 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp @@ -158,11 +158,9 @@ QString VToolLinePoint::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(line.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Angle")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) .arg(line.angle()) - .arg(tr("Label")) - .arg(second->name()); + .arg(tr("Label"), second->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index 908e26d53..9c1db3fab 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -339,13 +339,11 @@ QString VToolShoulderPoint::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(firstToCur.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Angle")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) .arg(firstToCur.angle()) .arg(QString("%1->%2").arg(second->name(), current->name())) .arg(qApp->fromPixel(secondToCur.length())) - .arg(tr("Label")) - .arg(current->name()); + .arg(tr("Label"), current->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index 31a3aa4a9..df0bf3674 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -262,7 +262,7 @@ void VToolBasePoint::SetBasePointPos(const QPointF &pos) void VToolBasePoint::DeleteToolWithConfirm(bool ask) { qCDebug(vTool, "Deleting base point."); - qApp->getSceneView()->itemClicked(nullptr); + emit qApp->getSceneView()->itemClicked(nullptr); if (ask) { qCDebug(vTool, "Asking."); @@ -370,8 +370,7 @@ QString VToolBasePoint::MakeToolTip() const const QString toolTip = QString("" "" "
%1: %2
") - .arg(tr("Label")) - .arg(point->name()); + .arg(tr("Label"), point->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index d564de7b6..47022c0af 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -312,15 +312,13 @@ QString VToolLineIntersect::MakeToolTip() const "") .arg(QString("%1->%2").arg(p1L1->name(), current->name())) .arg(qApp->fromPixel(p1L1ToCur.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(QString("%1->%2").arg(current->name(), p2L1->name())) + .arg(UnitsToStr(qApp->patternUnit(), true), QString("%1->%2").arg(current->name(), p2L1->name())) .arg(qApp->fromPixel(curToP2L1.length())) .arg(QString("%1->%2").arg(p1L2->name(), current->name())) .arg(qApp->fromPixel(p1L2ToCur.length())) .arg(QString("%1->%2").arg(current->name(), p2L2->name())) .arg(qApp->fromPixel(curToP2L2.length())) - .arg(tr("Label")) - .arg(current->name()); + .arg(tr("Label"), current->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index 83be29b30..6ce5a4423 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -353,15 +353,13 @@ QString VToolPointOfContact::MakeToolTip() const "") .arg(QString("%1->%2").arg(p1->name(), current->name())) .arg(qApp->fromPixel(p1ToCur.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(QString("%1->%2").arg(p2->name(), current->name())) + .arg(UnitsToStr(qApp->patternUnit(), true), QString("%1->%2").arg(p2->name(), current->name())) .arg(qApp->fromPixel(p2ToCur.length())) .arg(QString("%1 %2->%3").arg(tr("Length"), centerP->name(), current->name())) .arg(qApp->fromPixel(centerToCur.length())) .arg(QString("%1 %2->%3").arg(tr("Angle"), centerP->name(), current->name())) .arg(centerToCur.angle()) - .arg(tr("Label")) - .arg(current->name()); + .arg(tr("Label"), current->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 9d2f231d6..6614393dd 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -193,7 +193,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI if (selectedAction == actionOption) { qCDebug(vTool, "Show options."); - qApp->getSceneView()->itemClicked(nullptr); + emit qApp->getSceneView()->itemClicked(nullptr); m_dialog = QSharedPointer(new Dialog(getData(), m_id, qApp->getMainWindow())); m_dialog->setModal(true); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 4c7b0a667..65b42bf43 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -442,8 +442,7 @@ QString VToolLine::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(line.length())) - .arg(UnitsToStr(qApp->patternUnit(), true)) - .arg(tr("Angle")) + .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) .arg(line.angle()); return toolTip; } diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index 60d62678a..b788279a8 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -214,7 +214,7 @@ void VAbstractTool::DeleteToolWithConfirm(bool ask) if (_referens <= 1) { qCDebug(vTool, "No children."); - qApp->getSceneView()->itemClicked(nullptr); + emit qApp->getSceneView()->itemClicked(nullptr); if (ask) { qCDebug(vTool, "Asking."); diff --git a/src/libs/vtools/undocommands/addgroup.cpp b/src/libs/vtools/undocommands/addgroup.cpp index 61d053fcc..bfc8390e7 100644 --- a/src/libs/vtools/undocommands/addgroup.cpp +++ b/src/libs/vtools/undocommands/addgroup.cpp @@ -92,7 +92,7 @@ void AddGroup::undo() } VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView()); - doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo + emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/undocommands/addtocalc.cpp b/src/libs/vtools/undocommands/addtocalc.cpp index 703b792de..49e0baae1 100644 --- a/src/libs/vtools/undocommands/addtocalc.cpp +++ b/src/libs/vtools/undocommands/addtocalc.cpp @@ -78,7 +78,7 @@ void AddToCalc::undo() } emit NeedFullParsing(); VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView()); - doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo + emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo } //--------------------------------------------------------------------------------------------------------------------- @@ -125,7 +125,7 @@ void AddToCalc::RedoFullParsing() if (redoFlag) { emit NeedFullParsing(); - doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo + emit doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo } else { diff --git a/src/libs/vtools/undocommands/delgroup.cpp b/src/libs/vtools/undocommands/delgroup.cpp index 7d26023d7..ad3d2b630 100644 --- a/src/libs/vtools/undocommands/delgroup.cpp +++ b/src/libs/vtools/undocommands/delgroup.cpp @@ -58,7 +58,7 @@ void DelGroup::undo() { qCDebug(vUndo, "Undo."); - doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change + emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change QDomElement groups = doc->CreateGroups(); if (not groups.isNull()) @@ -82,7 +82,7 @@ void DelGroup::redo() qCDebug(vUndo, "Redo."); //Keep first! - doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change + emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change QDomElement groups = doc->CreateGroups(); if (not groups.isNull()) { diff --git a/src/libs/vtools/undocommands/deltool.cpp b/src/libs/vtools/undocommands/deltool.cpp index 67738f5a6..0559bd4ef 100644 --- a/src/libs/vtools/undocommands/deltool.cpp +++ b/src/libs/vtools/undocommands/deltool.cpp @@ -59,7 +59,7 @@ void DelTool::undo() UndoDeleteAfterSibling(parentNode, siblingId); emit NeedFullParsing(); //Keep last! - doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change + emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change } //--------------------------------------------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ void DelTool::redo() qCDebug(vUndo, "Redo."); //Keep first! - doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change + emit doc->SetCurrentPP(nameActivDraw);//Without this user will not see this change QDomElement domElement = doc->NodeById(nodeId); parentNode.removeChild(domElement); emit NeedFullParsing(); diff --git a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp index 6fde97be6..8a27c9ad7 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp @@ -175,8 +175,7 @@ void VisToolMove::RefreshGeometry() Visualization::toolTip = tr("Length = %1%2, angle = %3°, Shift - sticking angle, " "Mouse click - finish selecting a position") .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(tempLength)), - qApp->Settings()->GetOsSeparator())) - .arg(prefix) + qApp->Settings()->GetOsSeparator()), prefix) .arg(tempAngle); } else @@ -184,8 +183,7 @@ void VisToolMove::RefreshGeometry() Visualization::toolTip = tr("Length = %1%2, angle = %3°, rotation angle = %4°, Shift - sticking angle, " "Ctrl - change rotation origin point, Mouse click - finish creating") .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(tempLength)), - qApp->Settings()->GetOsSeparator())) - .arg(prefix) + qApp->Settings()->GetOsSeparator()), prefix) .arg(tempAngle) .arg(tempRoationAngle); } diff --git a/src/libs/vtools/visualization/line/vistoolendline.cpp b/src/libs/vtools/visualization/line/vistoolendline.cpp index 4e5924b67..0140c01ed 100644 --- a/src/libs/vtools/visualization/line/vistoolendline.cpp +++ b/src/libs/vtools/visualization/line/vistoolendline.cpp @@ -83,8 +83,7 @@ void VisToolEndLine::RefreshGeometry() "Shift - sticking angle, Enter - finish creation") .arg(this->line().angle()) .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length())), - qApp->Settings()->GetOsSeparator())) - .arg(prefix); + qApp->Settings()->GetOsSeparator()), prefix); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp index 152892742..967e0b516 100644 --- a/src/libs/vwidgets/vabstractmainwindow.cpp +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -57,7 +57,7 @@ bool VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVers msgBox.setText(tr("This file is using previous format version v%1. The current is v%2. " "Saving the file with this app version will update the format version for this " "file. This may prevent you from be able to open the file with older app versions. " - "Do you really want to continue?").arg(currentFormatVersion).arg(maxFormatVersion)); + "Do you really want to continue?").arg(currentFormatVersion, maxFormatVersion)); msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32)); diff --git a/src/test/CollectionTest/tst_tapecommandline.cpp b/src/test/CollectionTest/tst_tapecommandline.cpp index d32d994fa..8ab6b1814 100644 --- a/src/test/CollectionTest/tst_tapecommandline.cpp +++ b/src/test/CollectionTest/tst_tapecommandline.cpp @@ -31,8 +31,12 @@ #include "../vmisc/logging.h" #include +#include -const QString tmpTestFolder = QStringLiteral("tst_tape_tmp"); +namespace +{ +Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestFolder, (QLatin1String("tst_tape_tmp"))) +} //--------------------------------------------------------------------------------------------------------------------- TST_TapeCommandLine::TST_TapeCommandLine(QObject *parent) @@ -43,14 +47,14 @@ TST_TapeCommandLine::TST_TapeCommandLine(QObject *parent) //--------------------------------------------------------------------------------------------------------------------- void TST_TapeCommandLine::initTestCase() { - QDir tmpDir(tmpTestFolder); + QDir tmpDir(*tmpTestFolder); if (not tmpDir.removeRecursively()) { QFAIL("Fail to remove temp directory."); } if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + QStringLiteral("tst_tape"), - QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder)) + QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder)) { QFAIL("Fail to prepare files for testing."); } @@ -117,8 +121,8 @@ void TST_TapeCommandLine::OpenMeasurements() QString error; const int exit = Run(exitCode, TapePath(), QStringList() << "--test" - << QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() + - file, error); + << QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder + + QDir::separator() + file, error); QVERIFY2(exit == exitCode, qUtf8Printable(error)); } @@ -126,7 +130,7 @@ void TST_TapeCommandLine::OpenMeasurements() //--------------------------------------------------------------------------------------------------------------------- void TST_TapeCommandLine::cleanupTestCase() { - QDir tmpDir(tmpTestFolder); + QDir tmpDir(*tmpTestFolder); if (not tmpDir.removeRecursively()) { QWARN("Fail to remove temp directory."); diff --git a/src/test/CollectionTest/tst_valentinacommandline.cpp b/src/test/CollectionTest/tst_valentinacommandline.cpp index af0aaa7d6..0e5d277c9 100644 --- a/src/test/CollectionTest/tst_valentinacommandline.cpp +++ b/src/test/CollectionTest/tst_valentinacommandline.cpp @@ -31,9 +31,13 @@ #include "../vmisc/logging.h" #include +#include -const QString tmpTestFolder = QStringLiteral("tst_valentina_tmp"); -const QString tmpTestCollectionFolder = QStringLiteral("tst_valentina_collection_tmp"); +namespace +{ +Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestFolder, (QLatin1String("tst_valentina_tmp"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestCollectionFolder, (QLatin1String("tst_valentina_collection_tmp"))) +} TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent) :AbstractTest(parent) @@ -45,7 +49,7 @@ TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent) void TST_ValentinaCommandLine::initTestCase() { {// Test files - QDir tmpDir(tmpTestFolder); + QDir tmpDir(*tmpTestFolder); if (not tmpDir.removeRecursively()) { QFAIL("Fail to remove test temp directory."); @@ -53,14 +57,14 @@ void TST_ValentinaCommandLine::initTestCase() if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("tst_valentina"), - QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder)) + QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder)) { QFAIL("Fail to prepare test files for testing."); } } {// Collection - QDir tmpDir(tmpTestCollectionFolder); + QDir tmpDir(*tmpTestCollectionFolder); if (not tmpDir.removeRecursively()) { QFAIL("Fail to remove collection temp directory."); @@ -68,7 +72,7 @@ void TST_ValentinaCommandLine::initTestCase() if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("tst_valentina_collection"), - QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder)) + QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder)) { QFAIL("Fail to prepare collection files for testing."); } @@ -104,7 +108,7 @@ void TST_ValentinaCommandLine::OpenPatterns() QFETCH(int, exitCode); QString error; - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; const int exit = Run(exitCode, ValentinaPath(), QStringList() << "--test" << tmp + QDir::separator() + file, error); @@ -119,7 +123,7 @@ void TST_ValentinaCommandLine::ExportMode_data() const QTest::addColumn("arguments"); QTest::addColumn("exitCode"); - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; QTest::newRow("Issue #372")<< "issue_372.val" << QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp) @@ -155,7 +159,7 @@ void TST_ValentinaCommandLine::ExportMode() QFETCH(int, exitCode); QString error; - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); const int exit = Run(exitCode, ValentinaPath(), arg, error); @@ -170,7 +174,7 @@ void TST_ValentinaCommandLine::TestMode_data() const QTest::addColumn("arguments"); QTest::addColumn("exitCode"); - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; QTest::newRow("Issue #256. Correct path.")<< "issue_256.val" << QString("--test") @@ -213,7 +217,7 @@ void TST_ValentinaCommandLine::TestMode() QFETCH(int, exitCode); QString error; - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); const int exit = Run(exitCode, ValentinaPath(), arg, error); @@ -228,7 +232,7 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const QTest::addColumn("arguments"); QTest::addColumn("exitCode"); - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder; const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst")); const QString keyTest = QStringLiteral("--test"); @@ -274,7 +278,7 @@ void TST_ValentinaCommandLine::TestOpenCollection() QFETCH(int, exitCode); QString error; - const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder; + const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder; const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); const int exit = Run(exitCode, ValentinaPath(), arg, error); @@ -287,7 +291,7 @@ void TST_ValentinaCommandLine::TestOpenCollection() void TST_ValentinaCommandLine::cleanupTestCase() { { - QDir tmpDir(tmpTestFolder); + QDir tmpDir(*tmpTestFolder); if (not tmpDir.removeRecursively()) { QWARN("Fail to remove test temp directory."); @@ -295,7 +299,7 @@ void TST_ValentinaCommandLine::cleanupTestCase() } { - QDir tmpDir(tmpTestCollectionFolder); + QDir tmpDir(*tmpTestCollectionFolder); if (not tmpDir.removeRecursively()) { QWARN("Fail to remove collection temp directory."); diff --git a/src/test/TranslationsTest/tst_abstractregexp.cpp b/src/test/TranslationsTest/tst_abstractregexp.cpp index 8929489e1..932252ec8 100644 --- a/src/test/TranslationsTest/tst_abstractregexp.cpp +++ b/src/test/TranslationsTest/tst_abstractregexp.cpp @@ -61,9 +61,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale) if (QFileInfo(path+QLatin1String("/")+file).size() <= 34) { const QString message = QString("Translation variables for locale = %1 is empty. \nFull path: %2/%3") - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedLocale, path, file); QWARN(qUtf8Printable(message)); return ErrorSize; @@ -74,9 +72,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale) if (not m_vTranslator->load(file, path)) { const QString message = QString("Can't load translation variables for locale = %1. \nFull path: %2/%3") - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedLocale, path, file); QWARN(qUtf8Printable(message)); delete m_vTranslator; @@ -87,9 +83,7 @@ int TST_AbstractRegExp::LoadVariables(const QString &checkedLocale) if (not QCoreApplication::installTranslator(m_vTranslator)) { const QString message = QString("Can't install translation variables for locale = %1. \nFull path: %2/%3") - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedLocale, path, file); QWARN(qUtf8Printable(message)); delete m_vTranslator; @@ -153,7 +147,7 @@ void TST_AbstractRegExp::CallTestCheckRegExpNames() const QString translated = m_trMs->VarToUser(originalName); if (not re.match(translated).hasMatch()) { - const QString message = QString("Original name:'%1', translated name:'%2'").arg(originalName).arg(translated); + const QString message = QString("Original name:'%1', translated name:'%2'").arg(originalName, translated); QFAIL(qUtf8Printable(message)); } } @@ -169,7 +163,7 @@ void TST_AbstractRegExp::CallTestCheckIsNamesUnique() if (names.contains(translated)) { const QString message = QString("Name is not unique. Original name:'%1', translated name:'%2'") - .arg(originalName).arg(translated); + .arg(originalName, translated); QFAIL(qUtf8Printable(message)); } names.insert(translated); @@ -190,7 +184,7 @@ void TST_AbstractRegExp::CallTestCheckNoOriginalNamesInTranslation() { const QString message = QString("Translation repeat original name from other place. " "Original name:'%1', translated name:'%2'") - .arg(originalName).arg(translated); + .arg(originalName, translated); QFAIL(qUtf8Printable(message)); } } diff --git a/src/test/TranslationsTest/tst_abstracttranslation.cpp b/src/test/TranslationsTest/tst_abstracttranslation.cpp index fd1d6a90d..a95a2fc0c 100644 --- a/src/test/TranslationsTest/tst_abstracttranslation.cpp +++ b/src/test/TranslationsTest/tst_abstracttranslation.cpp @@ -52,17 +52,17 @@ TST_AbstractTranslation::TST_AbstractTranslation(QObject *parent) QDomNodeList TST_AbstractTranslation::LoadTSFile(const QString &filename) { tsFile.reset(); - tsFile = QSharedPointer(new QFile(QString("%1/%2").arg(TS_DIR).arg(filename))); + tsFile = QSharedPointer(new QFile(QString("%1/%2").arg(TS_DIR, filename))); if (not tsFile->exists()) { - const QString message = QString("Can't find '%1'.\n%2.").arg(filename).arg(tsFile->errorString()); + const QString message = QString("Can't find '%1'.\n%2.").arg(filename, tsFile->errorString()); QWARN(qUtf8Printable(message)); return QDomNodeList(); } if (tsFile->open(QIODevice::ReadOnly) == false) { - const QString message = QString("Can't open file '%1'.\n%2.").arg(filename).arg(tsFile->errorString()); + const QString message = QString("Can't open file '%1'.\n%2.").arg(filename, tsFile->errorString()); QWARN(qUtf8Printable(message)); return QDomNodeList(); } diff --git a/src/test/TranslationsTest/tst_buitinregexp.cpp b/src/test/TranslationsTest/tst_buitinregexp.cpp index b799d9f2d..d5a817b24 100644 --- a/src/test/TranslationsTest/tst_buitinregexp.cpp +++ b/src/test/TranslationsTest/tst_buitinregexp.cpp @@ -156,7 +156,7 @@ void TST_BuitInRegExp::TestCheckUnderlineExists_data() auto i = data.constBegin(); while (i != data.constEnd()) { - const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale).arg(i.key()); + const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, i.key()); QTest::newRow(qUtf8Printable(tag)) << i.key() << i.value(); ++i; } @@ -172,7 +172,7 @@ void TST_BuitInRegExp::TestCheckUnderlineExists() if ((translated.right(1) == QLatin1String("_")) != exists) { const QString message = QString("String '%1' doesn't contain underline. Original string is '%2'") - .arg(translated).arg(name); + .arg(translated, name); QFAIL(qUtf8Printable(message)); } } @@ -185,7 +185,7 @@ void TST_BuitInRegExp::TestCheckInternalVaribleRegExp_data() foreach(const QString &var, builInVariables) { - const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale).arg(var); + const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var); const QStringList originalNames = AllNames(); foreach(const QString &str, originalNames) { @@ -256,7 +256,7 @@ void TST_BuitInRegExp::PrepareData() foreach(const QString &str, originalNames) { - const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale).arg(str); + const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, str); QTest::newRow(qUtf8Printable(tag)) << str; } } diff --git a/src/test/TranslationsTest/tst_measurementregexp.cpp b/src/test/TranslationsTest/tst_measurementregexp.cpp index 86b31da82..0580fbb34 100644 --- a/src/test/TranslationsTest/tst_measurementregexp.cpp +++ b/src/test/TranslationsTest/tst_measurementregexp.cpp @@ -81,16 +81,14 @@ void TST_MeasurementRegExp::initTestCase() if (LoadMeasurements(m_system, m_locale) != NoError) { const QString message = QString("Couldn't load measurements. System = %1, locale = %2") - .arg(m_system) - .arg(m_locale); + .arg(m_system, m_locale); QSKIP(qUtf8Printable(message)); } if (LoadVariables(m_locale) != NoError) { const QString message = QString("Couldn't load variables. System = %1, locale = %2") - .arg(m_system) - .arg(m_locale); + .arg(m_system, m_locale); QSKIP(qUtf8Printable(message)); } @@ -172,7 +170,7 @@ void TST_MeasurementRegExp::PrepareData() foreach(const QString &str, originalNames) { - const QString tag = QString("System: '%1', locale: '%2'. Name '%3'").arg(m_system).arg(m_locale).arg(str); + const QString tag = QString("System: '%1', locale: '%2'. Name '%3'").arg(m_system, m_locale, str); QTest::newRow(qUtf8Printable(tag)) << str; } } @@ -187,15 +185,12 @@ QStringList TST_MeasurementRegExp::AllNames() int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const QString &checkedLocale) { const QString path = TranslationsPath(); - const QString file = QString("measurements_%1_%2.qm").arg(checkedSystem).arg(checkedLocale); + const QString file = QString("measurements_%1_%2.qm").arg(checkedSystem, checkedLocale); if (QFileInfo(path+QLatin1String("/")+file).size() <= 34) { const QString message = QString("Translation for system = %1 and locale = %2 is empty. \nFull path: %3/%4") - .arg(checkedSystem) - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedSystem, checkedLocale, path, file); QWARN(qUtf8Printable(message)); return ErrorSize; @@ -207,10 +202,7 @@ int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const if (not m_pmsTranslator->load(file, path)) { const QString message = QString("Can't load translation for system = %1 and locale = %2. \nFull path: %3/%4") - .arg(checkedSystem) - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedSystem, checkedLocale, path, file); QWARN(qUtf8Printable(message)); delete m_pmsTranslator; @@ -221,10 +213,7 @@ int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const if (not QCoreApplication::installTranslator(m_pmsTranslator)) { const QString message = QString("Can't install translation for system = %1 and locale = %2. \nFull path: %3/%4") - .arg(checkedSystem) - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedSystem, checkedLocale, path, file); QWARN(qUtf8Printable(message)); delete m_pmsTranslator; @@ -245,8 +234,7 @@ void TST_MeasurementRegExp::RemoveTrMeasurements(const QString &checkedSystem, c if (result == false) { const QString message = QString("Can't remove translation for system = %1 and locale = %2") - .arg(checkedSystem) - .arg(checkedLocale); + .arg(checkedSystem, checkedLocale); QWARN(qUtf8Printable(message)); } delete m_pmsTranslator; diff --git a/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp b/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp index ef5e891bf..afec77d69 100644 --- a/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp +++ b/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp @@ -155,9 +155,7 @@ int TST_QmuParserErrorMsg::LoadTranslation(const QString &checkedLocale) if (QFileInfo(path+QLatin1String("/")+file).size() <= 34) { const QString message = QString("Translation for locale = %1 is empty. \nFull path: %2/%3") - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedLocale, path, file); QWARN(qUtf8Printable(message)); return ErrorSize; @@ -168,9 +166,7 @@ int TST_QmuParserErrorMsg::LoadTranslation(const QString &checkedLocale) if (not appTranslator->load(file, path)) { const QString message = QString("Can't load translation for locale = %1. \nFull path: %2/%3") - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedLocale, path, file); QWARN(qUtf8Printable(message)); delete appTranslator; @@ -181,9 +177,7 @@ int TST_QmuParserErrorMsg::LoadTranslation(const QString &checkedLocale) if (not QCoreApplication::installTranslator(appTranslator)) { const QString message = QString("Can't install translation for locale = %1. \nFull path: %2/%3") - .arg(checkedLocale) - .arg(path) - .arg(file); + .arg(checkedLocale, path, file); QWARN(qUtf8Printable(message)); delete appTranslator; diff --git a/src/test/TranslationsTest/tst_tslocaletranslation.cpp b/src/test/TranslationsTest/tst_tslocaletranslation.cpp index 38c74a065..6577365d3 100644 --- a/src/test/TranslationsTest/tst_tslocaletranslation.cpp +++ b/src/test/TranslationsTest/tst_tslocaletranslation.cpp @@ -77,8 +77,7 @@ void TST_TSLocaleTranslation::CheckPlaceMarkerExist_data() continue; } - const QString message = QString("File '%1'. Check place holder source message '%2'").arg(filename) - .arg(source); + const QString message = QString("File '%1'. Check place holder source message '%2'").arg(filename, source); QTest::newRow(qUtf8Printable(message)) << source << translation; } else diff --git a/src/test/TranslationsTest/tst_tstranslation.cpp b/src/test/TranslationsTest/tst_tstranslation.cpp index eacdfa3c1..8fdb9680e 100644 --- a/src/test/TranslationsTest/tst_tstranslation.cpp +++ b/src/test/TranslationsTest/tst_tstranslation.cpp @@ -79,8 +79,7 @@ void TST_TSTranslation::CheckEnglishLocalization_data() continue; } - const QString message = QString("File '%1'. Check modification source message '%2'.").arg(fileName) - .arg(source); + const QString message = QString("File '%1'. Check modification source message '%2'.").arg(fileName, source); QTest::newRow(qUtf8Printable(message)) << source << translation; } else @@ -197,8 +196,7 @@ void TST_TSTranslation::PrepareOriginalStrings() continue; } - const QString tag = QString("File '%1'. Check modification source message '%2'.").arg(fileName) - .arg(source); + const QString tag = QString("File '%1'. Check modification source message '%2'.").arg(fileName, source); QTest::newRow(qUtf8Printable(tag)) << source << message; } else diff --git a/src/test/ValentinaTest/tst_qmutokenparser.cpp b/src/test/ValentinaTest/tst_qmutokenparser.cpp index 4002050a7..64c3513bc 100644 --- a/src/test/ValentinaTest/tst_qmutokenparser.cpp +++ b/src/test/ValentinaTest/tst_qmutokenparser.cpp @@ -115,19 +115,19 @@ void TST_QmuTokenParser::PrepareVal(qreal val, const QLocale &locale) { const QString formula = locale.toString(val); QString string = formula; - QString tag = QString("%1. String '%2'").arg(locale.name()).arg(string); + QString tag = QString("%1. String '%2'").arg(locale.name(), string); QTest::newRow(qUtf8Printable(tag)) << string << true << locale; string = formula+QLatin1String("+"); - tag = QString("%1. String '%2'").arg(locale.name()).arg(string); + tag = QString("%1. String '%2'").arg(locale.name(), string); QTest::newRow(qUtf8Printable(tag)) << string << false << locale; string = formula+QLatin1String("+")+formula; - tag = QString("%1. String '%2'").arg(locale.name()).arg(string); + tag = QString("%1. String '%2'").arg(locale.name(), string); QTest::newRow(qUtf8Printable(tag)) << string << false << locale; string = formula+QString("+б"); - tag = QString("%1. String '%2'").arg(locale.name()).arg(string); + tag = QString("%1. String '%2'").arg(locale.name(), string); QTest::newRow(qUtf8Printable(tag)) << string << false << locale; } diff --git a/src/test/ValentinaTest/tst_readval.cpp b/src/test/ValentinaTest/tst_readval.cpp index 14cf46276..7e46024ef 100644 --- a/src/test/ValentinaTest/tst_readval.cpp +++ b/src/test/ValentinaTest/tst_readval.cpp @@ -125,7 +125,7 @@ void TST_ReadVal::PrepareVal(qreal val, const QLocale &locale) //--------------------------------------------------------------------------------------------------------------------- void TST_ReadVal::PrepareString(const QString &str, const QLocale &locale, qreal val, int count) { - const QString tag = QString("%1. String '%2'").arg(locale.name()).arg(str); + const QString tag = QString("%1. String '%2'").arg(locale.name(), str); QTest::newRow(qUtf8Printable(tag)) << str << count << val << locale; } diff --git a/src/test/ValentinaTest/tst_vlockguard.cpp b/src/test/ValentinaTest/tst_vlockguard.cpp index 842a6659e..362f88dba 100644 --- a/src/test/ValentinaTest/tst_vlockguard.cpp +++ b/src/test/ValentinaTest/tst_vlockguard.cpp @@ -49,8 +49,8 @@ void TST_VLockGuard::TryLock() const VlpCreateLock(lock, fileName); fileName = lock->GetLockFile(); - QVERIFY2(QFileInfo(fileName).exists(), "Lock file doesn't exist!"); + QVERIFY2(QFileInfo::exists(fileName), "Lock file doesn't exist!"); lock.reset(); - QVERIFY2(not QFileInfo(fileName).exists(), "Lock file still exists!"); + QVERIFY2(not QFileInfo::exists(fileName), "Lock file still exists!"); } diff --git a/src/test/ValentinaTest/tst_vmeasurements.cpp b/src/test/ValentinaTest/tst_vmeasurements.cpp index fe92822f7..652cbb82b 100644 --- a/src/test/ValentinaTest/tst_vmeasurements.cpp +++ b/src/test/ValentinaTest/tst_vmeasurements.cpp @@ -166,7 +166,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile() QString error; const bool result = m->SaveDocument(fileName, error); - const QString message = QString("Error: %1 for code=%2").arg(error).arg(listSystems.at(i)); + const QString message = QString("Error: %1 for code=%2").arg(error, listSystems.at(i)); QVERIFY2(result, qUtf8Printable(message)); } else @@ -180,7 +180,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile() } catch (VException &e) { - const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage()).arg(listSystems.at(i)); + const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage(), listSystems.at(i)); QFAIL(qUtf8Printable(message)); } } @@ -217,7 +217,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile() QString error; const bool result = m->SaveDocument(fileName, error); - const QString message = QString("Error: %1 for code=%2").arg(error).arg(listSystems.at(i)); + const QString message = QString("Error: %1 for code=%2").arg(error, listSystems.at(i)); QVERIFY2(result, qUtf8Printable(message)); } else @@ -231,7 +231,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile() } catch (VException &e) { - const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage()).arg(listSystems.at(i)); + const QString message = QString("Error: %1 for code=%2").arg(e.ErrorMessage(), listSystems.at(i)); QFAIL(qUtf8Printable(message)); } } diff --git a/src/test/ValentinaTest/tst_vtranslatevars.cpp b/src/test/ValentinaTest/tst_vtranslatevars.cpp index b8870789a..bbb630ca5 100644 --- a/src/test/ValentinaTest/tst_vtranslatevars.cpp +++ b/src/test/ValentinaTest/tst_vtranslatevars.cpp @@ -146,7 +146,7 @@ void TST_VTranslateVars::PrepareVal(const QString &inputFormula, const QString & auto PREPARE_CASE = [locale](const QString &inputString, const QString &outputString) { - QString tag = QString("%1. String '%2'").arg(locale.name()).arg(inputString); + QString tag = QString("%1. String '%2'").arg(locale.name(), inputString); QTest::newRow(qUtf8Printable(tag)) << inputString << outputString << locale; };