Get format version.
--HG-- branch : feature
This commit is contained in:
parent
37cab897fa
commit
7b617223e9
|
@ -36,7 +36,7 @@ quint32 VContainer::_id = 0;
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContainer::VContainer()
|
||||
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
|
||||
:_size(50), sizeName(size_M), _height(176), heightName(height_M), gObjects(QHash<quint32, VGObject *>()),
|
||||
measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
|
||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
||||
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
|
||||
|
@ -51,7 +51,7 @@ VContainer &VContainer::operator =(const VContainer &data)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContainer::VContainer(const VContainer &data)
|
||||
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
|
||||
:_size(50), sizeName(size_M), _height(176), heightName(height_M), gObjects(QHash<quint32, VGObject *>()),
|
||||
measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
|
||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
||||
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
|
||||
|
|
|
@ -83,11 +83,12 @@ inline qint64 MessageHandler::column() const
|
|||
return m_sourceLocation.column();
|
||||
}
|
||||
|
||||
const QString VDomDocument::AttrId = QStringLiteral("id");
|
||||
const QString VDomDocument::AttrUnit = QStringLiteral("unit");
|
||||
const QString VDomDocument::UnitMM = QStringLiteral("mm");
|
||||
const QString VDomDocument::UnitCM = QStringLiteral("cm");
|
||||
const QString VDomDocument::AttrId = QStringLiteral("id");
|
||||
const QString VDomDocument::AttrUnit = QStringLiteral("unit");
|
||||
const QString VDomDocument::UnitMM = QStringLiteral("mm");
|
||||
const QString VDomDocument::UnitCM = QStringLiteral("cm");
|
||||
const QString VDomDocument::UnitINCH = QStringLiteral("inch");
|
||||
const QString VDomDocument::TagVersion = QStringLiteral("version");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDomDocument::VDomDocument(VContainer *data)
|
||||
|
@ -431,6 +432,30 @@ bool VDomDocument::SaveDocument(const QString &fileName)
|
|||
return result;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VDomDocument::Major() const
|
||||
{
|
||||
QString version = UniqueTagText(TagVersion, "0.0.0");
|
||||
QStringList v = version.split(".");
|
||||
return v.at(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VDomDocument::Minor() const
|
||||
{
|
||||
QString version = UniqueTagText(TagVersion, "0.0.0");
|
||||
QStringList v = version.split(".");
|
||||
return v.at(1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VDomDocument::Patch() const
|
||||
{
|
||||
QString version = UniqueTagText(TagVersion, "0.0.0");
|
||||
QStringList v = version.split(".");
|
||||
return v.at(2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDomDocument::setTagText(const QString &tag, const QString &text)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
#include <QDebug>
|
||||
#include "../options.h"
|
||||
|
||||
/*
|
||||
can be used like #if (V_FORMAT_VERSION >= V_FORMAT_VERSION_CHECK(4, 4, 0))
|
||||
*/
|
||||
#define V_FORMAT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
|
||||
|
||||
#ifdef Q_CC_GNU
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
|
@ -70,6 +75,7 @@ public:
|
|||
static const QString UnitMM;
|
||||
static const QString UnitCM;
|
||||
static const QString UnitINCH;
|
||||
static const QString TagVersion;
|
||||
/**
|
||||
* @param data container with variables
|
||||
* @param comboBoxDraws pointer to the ComboBox that will hold the pattern piece names
|
||||
|
@ -145,7 +151,10 @@ public:
|
|||
void setContent(const QString &fileName);
|
||||
static Valentina::Units StrToUnits(const QString &unit);
|
||||
static QString UnitsToStr(const Valentina::Units &unit);
|
||||
virtual bool SaveDocument(const QString &fileName);
|
||||
virtual bool SaveDocument(const QString &fileName);
|
||||
QString Major() const;
|
||||
QString Minor() const;
|
||||
QString Patch() const;
|
||||
protected:
|
||||
/**
|
||||
* @brief data container with data.
|
||||
|
|
|
@ -32,6 +32,14 @@
|
|||
#include "vdomdocument.h"
|
||||
#include <QDate>
|
||||
|
||||
/*
|
||||
VIT_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
*/
|
||||
// version without patch part
|
||||
#define VIT_MIN_VERSION 0x000100
|
||||
// max support version of format
|
||||
#define VIT_VERSION 0x000100
|
||||
|
||||
class VIndividualMeasurements:public VDomDocument
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -45,6 +45,14 @@ namespace Document
|
|||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents)
|
||||
|
||||
/*
|
||||
VAL_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
*/
|
||||
// version without patch part
|
||||
#define VAL_MIN_VERSION 0x000100
|
||||
// max support version of format
|
||||
#define VAL_VERSION 0x000100
|
||||
|
||||
/**
|
||||
* @brief The VPattern class working with pattern file.
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,14 @@
|
|||
|
||||
#include "vdomdocument.h"
|
||||
|
||||
/*
|
||||
VST_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
*/
|
||||
// version without patch part
|
||||
#define VST_MIN_VERSION 0x000100
|
||||
// max support version of format
|
||||
#define VST_VERSION 0x000100
|
||||
|
||||
class VStandardMeasurements:public VDomDocument
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue
Block a user