Avoid using global static variables.
This commit is contained in:
parent
ba9d9ff501
commit
ccdabec868
|
@ -130,7 +130,7 @@ void VPDialogAbout::FontPointSize(QWidget *w, int pointSize)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPDialogAbout::RetranslateUi()
|
void VPDialogAbout::RetranslateUi()
|
||||||
{
|
{
|
||||||
ui->label_Puzzle_Version->setText(QStringLiteral("Puzzle %1").arg(APP_VERSION_STR));
|
ui->label_Puzzle_Version->setText(QStringLiteral("Puzzle %1").arg(AppVersionStr()));
|
||||||
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
|
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
|
||||||
ui->label_QT_Version->setText(buildCompatibilityString());
|
ui->label_QT_Version->setText(buildCompatibilityString());
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ VPApplication::VPApplication(int &argc, char **argv)
|
||||||
setOrganizationName(QStringLiteral(VER_COMPANYNAME_STR));
|
setOrganizationName(QStringLiteral(VER_COMPANYNAME_STR));
|
||||||
setOrganizationDomain(QStringLiteral(VER_COMPANYDOMAIN_STR));
|
setOrganizationDomain(QStringLiteral(VER_COMPANYDOMAIN_STR));
|
||||||
// Setting the Application version
|
// Setting the Application version
|
||||||
setApplicationVersion(APP_VERSION_STR);
|
setApplicationVersion(AppVersionStr());
|
||||||
// We have been running Puzzle in two different cases.
|
// We have been running Puzzle in two different cases.
|
||||||
// The first inside own bundle where info.plist is works fine, but the second,
|
// The first inside own bundle where info.plist is works fine, but the second,
|
||||||
// when we run inside Valentina's bundle, require direct setting the icon.
|
// when we run inside Valentina's bundle, require direct setting the icon.
|
||||||
|
@ -420,7 +420,7 @@ void VPApplication::InitOptions()
|
||||||
|
|
||||||
OpenSettings();
|
OpenSettings();
|
||||||
|
|
||||||
qCDebug(pApp, "Version: %s", qUtf8Printable(APP_VERSION_STR));
|
qCDebug(pApp, "Version: %s", qUtf8Printable(AppVersionStr()));
|
||||||
qCDebug(pApp, "Build revision: %s", BUILD_REVISION);
|
qCDebug(pApp, "Build revision: %s", BUILD_REVISION);
|
||||||
qCDebug(pApp, "%s", qUtf8Printable(buildCompatibilityString()));
|
qCDebug(pApp, "%s", qUtf8Printable(buildCompatibilityString()));
|
||||||
qCDebug(pApp, "Built on %s at %s", __DATE__, __TIME__);
|
qCDebug(pApp, "Built on %s at %s", __DATE__, __TIME__);
|
||||||
|
|
|
@ -142,7 +142,7 @@ void VPLayoutFileWriter::WriteFile(const VPLayoutPtr &layout, QIODevice *file)
|
||||||
|
|
||||||
writeStartDocument();
|
writeStartDocument();
|
||||||
writeComment(
|
writeComment(
|
||||||
QStringLiteral("Layout created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR));
|
QStringLiteral("Layout created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr()));
|
||||||
WriteLayout(layout);
|
WriteLayout(layout);
|
||||||
writeEndDocument();
|
writeEndDocument();
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ void DialogAboutTape::FontPointSize(QWidget *w, int pointSize)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogAboutTape::RetranslateUi()
|
void DialogAboutTape::RetranslateUi()
|
||||||
{
|
{
|
||||||
ui->label_Tape_Version->setText(QStringLiteral("Tape %1").arg(APP_VERSION_STR));
|
ui->label_Tape_Version->setText(QStringLiteral("Tape %1").arg(AppVersionStr()));
|
||||||
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
|
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
|
||||||
ui->label_QT_Version->setText(buildCompatibilityString());
|
ui->label_QT_Version->setText(buildCompatibilityString());
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ MApplication::MApplication(int &argc, char **argv)
|
||||||
setOrganizationName(QStringLiteral(VER_COMPANYNAME_STR));
|
setOrganizationName(QStringLiteral(VER_COMPANYNAME_STR));
|
||||||
setOrganizationDomain(QStringLiteral(VER_COMPANYDOMAIN_STR));
|
setOrganizationDomain(QStringLiteral(VER_COMPANYDOMAIN_STR));
|
||||||
// Setting the Application version
|
// Setting the Application version
|
||||||
setApplicationVersion(APP_VERSION_STR);
|
setApplicationVersion(AppVersionStr());
|
||||||
// We have been running Tape in two different cases.
|
// We have been running Tape in two different cases.
|
||||||
// The first inside own bundle where info.plist is works fine, but the second,
|
// The first inside own bundle where info.plist is works fine, but the second,
|
||||||
// when we run inside Valentina's bundle, require direct setting the icon.
|
// when we run inside Valentina's bundle, require direct setting the icon.
|
||||||
|
@ -471,7 +471,7 @@ void MApplication::InitOptions()
|
||||||
|
|
||||||
OpenSettings();
|
OpenSettings();
|
||||||
|
|
||||||
qCDebug(mApp, "Version: %s", qUtf8Printable(APP_VERSION_STR));
|
qCDebug(mApp, "Version: %s", qUtf8Printable(AppVersionStr()));
|
||||||
qCDebug(mApp, "Build revision: %s", BUILD_REVISION);
|
qCDebug(mApp, "Build revision: %s", BUILD_REVISION);
|
||||||
qCDebug(mApp, "%s", qUtf8Printable(buildCompatibilityString()));
|
qCDebug(mApp, "%s", qUtf8Printable(buildCompatibilityString()));
|
||||||
qCDebug(mApp, "Built on %s at %s", __DATE__, __TIME__);
|
qCDebug(mApp, "Built on %s at %s", __DATE__, __TIME__);
|
||||||
|
|
|
@ -380,7 +380,7 @@ VApplication::VApplication(int &argc, char **argv)
|
||||||
setOrganizationName(QStringLiteral(VER_COMPANYNAME_STR));
|
setOrganizationName(QStringLiteral(VER_COMPANYNAME_STR));
|
||||||
setOrganizationDomain(QStringLiteral(VER_COMPANYDOMAIN_STR));
|
setOrganizationDomain(QStringLiteral(VER_COMPANYDOMAIN_STR));
|
||||||
// Setting the Application version
|
// Setting the Application version
|
||||||
setApplicationVersion(APP_VERSION_STR);
|
setApplicationVersion(AppVersionStr());
|
||||||
// making sure will create new instance...just in case we will ever do 2 objects of VApplication
|
// making sure will create new instance...just in case we will ever do 2 objects of VApplication
|
||||||
VCommandLine::Reset();
|
VCommandLine::Reset();
|
||||||
VTheme::Instance()->StoreDefaultThemeName(QIcon::themeName());
|
VTheme::Instance()->StoreDefaultThemeName(QIcon::themeName());
|
||||||
|
@ -672,7 +672,7 @@ void VApplication::InitOptions()
|
||||||
// Run creation log after sending crash report
|
// Run creation log after sending crash report
|
||||||
StartLogging();
|
StartLogging();
|
||||||
|
|
||||||
qDebug() << "Version:" << APP_VERSION_STR;
|
qDebug() << "Version:" << AppVersionStr();
|
||||||
qDebug() << "Build revision:" << BUILD_REVISION;
|
qDebug() << "Build revision:" << BUILD_REVISION;
|
||||||
qDebug() << buildCompatibilityString();
|
qDebug() << buildCompatibilityString();
|
||||||
qDebug() << "Built on" << __DATE__ << "at" << __TIME__;
|
qDebug() << "Built on" << __DATE__ << "at" << __TIME__;
|
||||||
|
|
|
@ -52,7 +52,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
|
VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
|
||||||
: setLocale(QLocale::c());
|
: setLocale(QLocale::c());
|
||||||
|
|
||||||
ui->label_Valentina_Version->setText(QStringLiteral("Valentina %1").arg(APP_VERSION_STR));
|
ui->label_Valentina_Version->setText(QStringLiteral("Valentina %1").arg(AppVersionStr()));
|
||||||
ui->labelBuildRevision->setText(QStringLiteral("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
|
ui->labelBuildRevision->setText(QStringLiteral("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
|
||||||
ui->label_QT_Version->setText(buildCompatibilityString());
|
ui->label_QT_Version->setText(buildCompatibilityString());
|
||||||
|
|
||||||
|
|
|
@ -814,13 +814,13 @@ auto DialogLayoutSettings::MakeHelpTemplateList() -> QString
|
||||||
QString out = QChar('\n');
|
QString out = QChar('\n');
|
||||||
|
|
||||||
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
||||||
for (int i = 0; i < VAbstractLayoutDialog::pageFormatNames.size(); ++i)
|
for (int i = 0; i < VAbstractLayoutDialog::PageFormatNames().size(); ++i)
|
||||||
{
|
{
|
||||||
if (cntr < static_cast<int>(PaperSizeTemplate::Custom))// Don't include custom template
|
if (cntr < static_cast<int>(PaperSizeTemplate::Custom))// Don't include custom template
|
||||||
{
|
{
|
||||||
out += "\t* "+VAbstractLayoutDialog::pageFormatNames.at(i)+" = "+ QString::number(cntr++);
|
out += "\t* "+VAbstractLayoutDialog::PageFormatNames().at(i)+" = "+ QString::number(cntr++);
|
||||||
|
|
||||||
if (i < VAbstractLayoutDialog::pageFormatNames.size() - 2)
|
if (i < VAbstractLayoutDialog::PageFormatNames().size() - 2)
|
||||||
{
|
{
|
||||||
out += QLatin1String(",\n");
|
out += QLatin1String(",\n");
|
||||||
}
|
}
|
||||||
|
@ -840,7 +840,7 @@ auto DialogLayoutSettings::MakeHelpTiledPdfTemplateList() -> QString
|
||||||
|
|
||||||
for (int i = 0; i <= static_cast<int>(PaperSizeTemplate::Tabloid); ++i)
|
for (int i = 0; i <= static_cast<int>(PaperSizeTemplate::Tabloid); ++i)
|
||||||
{
|
{
|
||||||
out += "\t* "+VAbstractLayoutDialog::pageFormatNames.at(i)+" = "+ QString::number(i);
|
out += "\t* "+VAbstractLayoutDialog::PageFormatNames().at(i)+" = "+ QString::number(i);
|
||||||
|
|
||||||
if (i < static_cast<int>(PaperSizeTemplate::Tabloid))
|
if (i < static_cast<int>(PaperSizeTemplate::Tabloid))
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,8 +71,6 @@ auto main(int argc, char *argv[]) -> int
|
||||||
Q_INIT_RESOURCE(win_theme); // NOLINT
|
Q_INIT_RESOURCE(win_theme); // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
VAbstractApplication::WinAttachConsole();
|
VAbstractApplication::WinAttachConsole();
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,6 +101,8 @@ auto main(int argc, char *argv[]) -> int
|
||||||
VApplication app(argc, argv);
|
VApplication app(argc, argv);
|
||||||
app.InitOptions();
|
app.InitOptions();
|
||||||
|
|
||||||
|
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
VApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.valentina.desktop"));
|
VApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.valentina.desktop"));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -140,7 +140,7 @@ namespace
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto FileComment() -> QString
|
auto FileComment() -> QString
|
||||||
{
|
{
|
||||||
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR);
|
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -317,35 +317,35 @@ const QString rotationElArc_ = rotation_V + elarc_;
|
||||||
const QString pieceArea_ = QStringLiteral("PieceArea_");
|
const QString pieceArea_ = QStringLiteral("PieceArea_");
|
||||||
const QString pieceSeamLineArea_ = QStringLiteral("PieceSeamLineArea_");
|
const QString pieceSeamLineArea_ = QStringLiteral("PieceSeamLineArea_");
|
||||||
|
|
||||||
const QStringList builInVariables
|
auto BuilInVariables() -> QStringList
|
||||||
{
|
{
|
||||||
measurement_,
|
return {measurement_,
|
||||||
increment_,
|
increment_,
|
||||||
line_,
|
line_,
|
||||||
angleLine_,
|
angleLine_,
|
||||||
arc_,
|
arc_,
|
||||||
elarc_,
|
elarc_,
|
||||||
spl_,
|
spl_,
|
||||||
splPath,
|
splPath,
|
||||||
radiusArc_,
|
radiusArc_,
|
||||||
radius1ElArc_,
|
radius1ElArc_,
|
||||||
radius2ElArc_,
|
radius2ElArc_,
|
||||||
angle1Arc_,
|
angle1Arc_,
|
||||||
angle2Arc_,
|
angle2Arc_,
|
||||||
angle1ElArc_,
|
angle1ElArc_,
|
||||||
angle2ElArc_,
|
angle2ElArc_,
|
||||||
angle1Spl_,
|
angle1Spl_,
|
||||||
angle2Spl_,
|
angle2Spl_,
|
||||||
angle1SplPath,
|
angle1SplPath,
|
||||||
angle2SplPath,
|
angle2SplPath,
|
||||||
seg_,
|
seg_,
|
||||||
currentLength,
|
currentLength,
|
||||||
currentSeamAllowance,
|
currentSeamAllowance,
|
||||||
c1LengthSpl_,
|
c1LengthSpl_,
|
||||||
c2LengthSpl_,
|
c2LengthSpl_,
|
||||||
c1LengthSplPath,
|
c1LengthSplPath,
|
||||||
c2LengthSplPath,
|
c2LengthSplPath,
|
||||||
rotationElArc_,
|
rotationElArc_,
|
||||||
pieceArea_,
|
pieceArea_,
|
||||||
pieceSeamLineArea_
|
pieceSeamLineArea_};
|
||||||
};
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ extern const QString rotationElArc_;
|
||||||
extern const QString pieceArea_;
|
extern const QString pieceArea_;
|
||||||
extern const QString pieceSeamLineArea_;
|
extern const QString pieceSeamLineArea_;
|
||||||
|
|
||||||
extern const QStringList builInVariables;
|
auto BuilInVariables() -> QStringList;
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
|
|
@ -2041,7 +2041,7 @@ auto VAbstractPattern::ListFinalMeasurementsExpressions() const -> QVector<VForm
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractPattern::IsVariable(const QString &token) const -> bool
|
auto VAbstractPattern::IsVariable(const QString &token) const -> bool
|
||||||
{
|
{
|
||||||
for (const auto &var : builInVariables)
|
for (const auto &var : BuilInVariables())
|
||||||
{
|
{
|
||||||
if (token.indexOf(var) == 0)
|
if (token.indexOf(var) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2065,7 +2065,7 @@ auto VAbstractPattern::IsVariable(const QString &token) const -> bool
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractPattern::IsFunction(const QString &token) const -> bool
|
auto VAbstractPattern::IsFunction(const QString &token) const -> bool
|
||||||
{
|
{
|
||||||
for (const auto &fn : builInFunctions)
|
for (const auto &fn : BuilInFunctions())
|
||||||
{
|
{
|
||||||
if (token.indexOf(fn) == 0)
|
if (token.indexOf(fn) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -551,7 +551,7 @@ void QmuParserBase::DefineOprt( const QString &a_sName, fun_type2 a_pFun, unsign
|
||||||
// Check for conflicts with built in operator names
|
// Check for conflicts with built in operator names
|
||||||
for (int i=0; m_bBuiltInOp && i<cmENDIF; ++i)
|
for (int i=0; m_bBuiltInOp && i<cmENDIF; ++i)
|
||||||
{
|
{
|
||||||
if (a_sName == c_DefaultOprt.at(i))
|
if (a_sName == GetOprtDef().at(i))
|
||||||
{
|
{
|
||||||
Error(ecBUILTIN_OVERLOAD, -1, a_sName);
|
Error(ecBUILTIN_OVERLOAD, -1, a_sName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
typedef QmuParserTokenReader token_reader_type;
|
typedef QmuParserTokenReader token_reader_type;
|
||||||
|
|
||||||
static const QStringList c_DefaultOprt;
|
|
||||||
QLocale m_locale; ///< The locale used by the parser
|
QLocale m_locale; ///< The locale used by the parser
|
||||||
QChar m_decimalPoint;
|
QChar m_decimalPoint;
|
||||||
QChar m_thousandsSeparator;
|
QChar m_thousandsSeparator;
|
||||||
|
@ -328,6 +327,15 @@ inline void QmuParserBase::AddValIdent(identfun_type a_pCallback)
|
||||||
*/
|
*/
|
||||||
inline auto QmuParserBase::GetOprtDef() -> const QStringList &
|
inline auto QmuParserBase::GetOprtDef() -> const QStringList &
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Identifiers for built in binary operators.
|
||||||
|
*
|
||||||
|
* When defining custom binary operators with #AddOprt(...) make sure not to choose
|
||||||
|
* names conflicting with these definitions.
|
||||||
|
*/
|
||||||
|
const static QStringList c_DefaultOprt = {"<=", ">=", "!=", "==", QChar('<'), QChar('>'),
|
||||||
|
QChar('+'), QChar('-'), QChar('*'), QChar('/'), QChar('^'), "&&",
|
||||||
|
"||", QChar('='), QChar('('), QChar(')'), QChar('?'), QChar(':')};
|
||||||
return c_DefaultOprt;
|
return c_DefaultOprt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,14 +116,14 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(QmuParserErrorMsg) // NOLINT
|
Q_DISABLE_COPY_MOVE(QmuParserErrorMsg) // NOLINT
|
||||||
QMap<int, QmuTranslation> m_vErrMsg; ///< A map with the predefined error messages
|
QMap<int, QmuTranslation> m_vErrMsg; ///< A map with the predefined error messages
|
||||||
static const self_type m_Instance; ///< The instance pointer
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
inline auto QmuParserErrorMsg::Instance() -> const QmuParserErrorMsg &
|
inline auto QmuParserErrorMsg::Instance() -> const QmuParserErrorMsg &
|
||||||
{
|
{
|
||||||
return m_Instance;
|
const static QmuParserErrorMsg instance;
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -122,7 +122,7 @@ QT_WARNING_POP
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto FileComment() -> QString
|
auto FileComment() -> QString
|
||||||
{
|
{
|
||||||
return QString("Measurements created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR);
|
return QString("Measurements created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr());
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,7 @@ namespace
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline auto FileComment() -> QString
|
inline auto FileComment() -> QString
|
||||||
{
|
{
|
||||||
return QStringLiteral("Recipe created with Valentina v%1 (https://smart-pattern.com.ua/).")
|
return QStringLiteral("Recipe created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr());
|
||||||
.arg(APP_VERSION_STR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -150,7 +149,7 @@ auto VPatternRecipe::Prerequisite() -> QDomElement
|
||||||
*/
|
*/
|
||||||
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
||||||
|
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), APP_VERSION_STR));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), AppVersionStr()));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"),
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"),
|
||||||
UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
|
UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto FileComment() -> QString
|
auto FileComment() -> QString
|
||||||
{
|
{
|
||||||
return QString("Watermark created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR);
|
return QString("Watermark created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr());
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -32,26 +32,6 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
// must be the same order as PaperSizeTemplate constants
|
|
||||||
const VAbstractLayoutDialog::FormatsVector VAbstractLayoutDialog::pageFormatNames{
|
|
||||||
QStringLiteral("A0"),
|
|
||||||
QStringLiteral("A1"),
|
|
||||||
QStringLiteral("A2"),
|
|
||||||
QStringLiteral("A3"),
|
|
||||||
QStringLiteral("A4"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Letter", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Legal", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Tabloid", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 24in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 30in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 36in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 42in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 44in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 48in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 62in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Roll 72in", "Paper format"),
|
|
||||||
QApplication::translate("VAbstractLayoutDialog", "Custom", "Paper format")};
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractLayoutDialog::VAbstractLayoutDialog(QWidget *parent)
|
VAbstractLayoutDialog::VAbstractLayoutDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
@ -67,7 +47,7 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
|
||||||
const QString pdi = QStringLiteral("(%1ppi)").arg(PrintDPI);
|
const QString pdi = QStringLiteral("(%1ppi)").arg(PrintDPI);
|
||||||
|
|
||||||
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
||||||
for (const auto &v : pageFormatNames)
|
for (const auto &v : PageFormatNames())
|
||||||
{
|
{
|
||||||
if (cntr <= static_cast<int>(PaperSizeTemplate::Tabloid))
|
if (cntr <= static_cast<int>(PaperSizeTemplate::Tabloid))
|
||||||
{
|
{
|
||||||
|
@ -103,6 +83,31 @@ void VAbstractLayoutDialog::InitTileTemplates(QComboBox *comboBoxTemplates, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractLayoutDialog::PageFormatNames() -> const VAbstractLayoutDialog::FormatsVector &
|
||||||
|
{
|
||||||
|
// must be the same order as PaperSizeTemplate constants
|
||||||
|
static const FormatsVector pageFormatNames{
|
||||||
|
QStringLiteral("A0"),
|
||||||
|
QStringLiteral("A1"),
|
||||||
|
QStringLiteral("A2"),
|
||||||
|
QStringLiteral("A3"),
|
||||||
|
QStringLiteral("A4"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Letter", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Legal", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Tabloid", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 24in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 30in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 36in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 42in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 44in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 48in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 62in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Roll 72in", "Paper format"),
|
||||||
|
QApplication::translate("VAbstractLayoutDialog", "Custom", "Paper format")};
|
||||||
|
return pageFormatNames;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractLayoutDialog::GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF
|
auto VAbstractLayoutDialog::GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,9 +71,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef QStringList FormatsVector;
|
typedef QStringList FormatsVector;
|
||||||
const static FormatsVector pageFormatNames;
|
|
||||||
typedef int VIndexType;
|
typedef int VIndexType;
|
||||||
|
|
||||||
|
static auto PageFormatNames() -> const FormatsVector &;
|
||||||
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;
|
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -78,31 +78,15 @@ const QString avg_F = QStringLiteral("avg");
|
||||||
const QString fmod_F = QStringLiteral("fmod");
|
const QString fmod_F = QStringLiteral("fmod");
|
||||||
const QString warning_F = QStringLiteral("warning");
|
const QString warning_F = QStringLiteral("warning");
|
||||||
|
|
||||||
const QStringList builInFunctions
|
auto BuilInFunctions() -> QStringList
|
||||||
{
|
{
|
||||||
degTorad_F, radTodeg_F,
|
return {degTorad_F, radTodeg_F, sin_F, cos_F, tan_F, asin_F, acos_F, atan_F, sinh_F, cosh_F,
|
||||||
sin_F, cos_F, tan_F,
|
tanh_F, asinh_F, acosh_F, atanh_F, sinD_F, cosD_F, tanD_F, asinD_F, acosD_F, atanD_F,
|
||||||
asin_F, acos_F, atan_F,
|
log2_F, log10_F, log_F, ln_F, exp_F, sqrt_F, sign_F, rint_F, r2cm_F, csrCm_F,
|
||||||
sinh_F, cosh_F, tanh_F,
|
csrInch_F, abs_F, min_F, max_F, sum_F, avg_F, fmod_F, warning_F};
|
||||||
asinh_F, acosh_F, atanh_F,
|
}
|
||||||
sinD_F, cosD_F, tanD_F,
|
|
||||||
asinD_F, acosD_F, atanD_F,
|
|
||||||
log2_F, log10_F, log_F,
|
|
||||||
ln_F,
|
|
||||||
exp_F,
|
|
||||||
sqrt_F,
|
|
||||||
sign_F,
|
|
||||||
rint_F, r2cm_F,
|
|
||||||
csrCm_F, csrInch_F,
|
|
||||||
abs_F,
|
|
||||||
min_F, max_F,
|
|
||||||
sum_F,
|
|
||||||
avg_F,
|
|
||||||
fmod_F,
|
|
||||||
warning_F
|
|
||||||
};
|
|
||||||
|
|
||||||
const QString pl_size = QStringLiteral("size");
|
const QString pl_size = QStringLiteral("size");
|
||||||
const QString pl_height = QStringLiteral("height");
|
const QString pl_height = QStringLiteral("height");
|
||||||
const QString pl_hip = QStringLiteral("hip");
|
const QString pl_hip = QStringLiteral("hip");
|
||||||
const QString pl_waist = QStringLiteral("waist");
|
const QString pl_waist = QStringLiteral("waist");
|
||||||
|
|
|
@ -87,7 +87,7 @@ extern const QString avg_F;
|
||||||
extern const QString fmod_F;
|
extern const QString fmod_F;
|
||||||
extern const QString warning_F;
|
extern const QString warning_F;
|
||||||
|
|
||||||
extern const QStringList builInFunctions;
|
auto BuilInFunctions() -> QStringList;
|
||||||
|
|
||||||
// Placeholders
|
// Placeholders
|
||||||
extern const QString pl_height;
|
extern const QString pl_height;
|
||||||
|
|
|
@ -41,8 +41,13 @@
|
||||||
#define LATEST_TAG_DISTANCE VCS_REPO_STATE_DISTANCE
|
#define LATEST_TAG_DISTANCE VCS_REPO_STATE_DISTANCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const QString APP_VERSION_STR(
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION).arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE));
|
auto AppVersionStr() -> const QString &
|
||||||
|
{
|
||||||
|
static const QString appVersionStr =
|
||||||
|
QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION).arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE);
|
||||||
|
return appVersionStr;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto compilerString() -> QString
|
auto compilerString() -> QString
|
||||||
|
|
|
@ -35,7 +35,7 @@ constexpr unsigned MAJOR_VERSION = 0;
|
||||||
constexpr unsigned MINOR_VERSION = 7;
|
constexpr unsigned MINOR_VERSION = 7;
|
||||||
constexpr unsigned DEBUG_VERSION = 52;
|
constexpr unsigned DEBUG_VERSION = 52;
|
||||||
|
|
||||||
extern const QString APP_VERSION_STR;
|
auto AppVersionStr() -> const QString &;
|
||||||
|
|
||||||
constexpr inline auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned
|
constexpr inline auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned
|
||||||
{
|
{
|
||||||
|
|
|
@ -668,7 +668,7 @@ auto VContainer::IsUnique(const QString &name, const QString &nspace) -> bool
|
||||||
{
|
{
|
||||||
if (uniqueNames.contains(nspace))
|
if (uniqueNames.contains(nspace))
|
||||||
{
|
{
|
||||||
return (!uniqueNames.value(nspace).contains(name) && !builInFunctions.contains(name));
|
return (!uniqueNames.value(nspace).contains(name) && !BuilInFunctions().contains(name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -687,7 +687,7 @@ auto VContainer::AllUniqueNames(const QString &nspace) -> QStringList
|
||||||
{
|
{
|
||||||
if (uniqueNames.contains(nspace))
|
if (uniqueNames.contains(nspace))
|
||||||
{
|
{
|
||||||
QStringList names = builInFunctions;
|
QStringList names = BuilInFunctions();
|
||||||
names.append(uniqueNames.value(nspace).values());
|
names.append(uniqueNames.value(nspace).values());
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,8 @@ void TST_BuitInRegExp::TestCheckUnderlineExists_data()
|
||||||
data.insert(pieceArea_, true);
|
data.insert(pieceArea_, true);
|
||||||
data.insert(pieceSeamLineArea_, true);
|
data.insert(pieceSeamLineArea_, true);
|
||||||
|
|
||||||
//Catch case when new internal variable appears.
|
// Catch case when new internal variable appears.
|
||||||
QCOMPARE(data.size(), builInVariables.size());
|
QCOMPARE(data.size(), BuilInVariables().size());
|
||||||
|
|
||||||
QTest::addColumn<QString>("name");
|
QTest::addColumn<QString>("name");
|
||||||
QTest::addColumn<bool>("exists");
|
QTest::addColumn<bool>("exists");
|
||||||
|
@ -209,7 +209,7 @@ void TST_BuitInRegExp::TestCheckInternalVaribleRegExp_data()
|
||||||
QTest::addColumn<QString>("var");
|
QTest::addColumn<QString>("var");
|
||||||
QTest::addColumn<QString>("originalName");
|
QTest::addColumn<QString>("originalName");
|
||||||
|
|
||||||
for (const auto &var : qAsConst(builInVariables))
|
for (const auto &var : BuilInVariables())
|
||||||
{
|
{
|
||||||
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var);
|
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var);
|
||||||
const QStringList originalNames = AllNames();
|
const QStringList originalNames = AllNames();
|
||||||
|
@ -286,5 +286,5 @@ void TST_BuitInRegExp::PrepareData()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto TST_BuitInRegExp::AllNames() -> QStringList
|
auto TST_BuitInRegExp::AllNames() -> QStringList
|
||||||
{
|
{
|
||||||
return builInFunctions + builInVariables;
|
return BuilInFunctions() + BuilInVariables();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user