2014-12-11 16:12:16 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpatternconverter.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 11 12, 2014
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2014-12-11 16:12:16 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2014-12-11 16:12:16 +01:00
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VPATTERNCONVERTER_H
|
|
|
|
#define VPATTERNCONVERTER_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QDomElement>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QSet>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2014-12-11 16:12:16 +01:00
|
|
|
#include "vabstractconverter.h"
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
class QDomElement;
|
|
|
|
|
2021-09-25 10:43:05 +02:00
|
|
|
class VPatternConverter final : public VAbstractConverter
|
2014-12-11 16:12:16 +01:00
|
|
|
{
|
2014-12-31 13:28:08 +01:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(VPatternConverter)
|
2014-12-11 16:12:16 +01:00
|
|
|
public:
|
2015-10-12 13:52:48 +02:00
|
|
|
explicit VPatternConverter(const QString &fileName);
|
2017-04-01 16:27:55 +02:00
|
|
|
virtual ~VPatternConverter() Q_DECL_EQ_DEFAULT;
|
2014-12-11 16:12:16 +01:00
|
|
|
|
2016-07-07 17:04:26 +02:00
|
|
|
static const QString PatternMaxVerStr;
|
|
|
|
static const QString CurrentSchema;
|
2021-09-14 18:47:41 +02:00
|
|
|
static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4);
|
2022-08-03 19:05:09 +02:00
|
|
|
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 1);
|
2014-12-11 20:44:48 +01:00
|
|
|
|
|
|
|
protected:
|
2022-02-18 15:32:43 +01:00
|
|
|
void Save() override;
|
|
|
|
|
2021-09-14 18:47:41 +02:00
|
|
|
virtual unsigned MinVer() const override;
|
|
|
|
virtual unsigned MaxVer() const override;
|
2014-12-11 20:44:48 +01:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual QString MinVerStr() const override;
|
|
|
|
virtual QString MaxVerStr() const override;
|
2014-12-11 21:16:03 +01:00
|
|
|
|
2021-09-14 18:47:41 +02:00
|
|
|
virtual QString XSDSchema(unsigned ver) const override;
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void ApplyPatches() override;
|
|
|
|
virtual void DowngradeToCurrentMaxVersion() override;
|
2014-12-11 21:16:03 +01:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual bool IsReadOnly() const override;
|
2017-02-04 12:28:47 +01:00
|
|
|
|
2014-12-11 20:44:48 +01:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VPatternConverter)
|
2016-07-07 17:04:26 +02:00
|
|
|
static const QString PatternMinVerStr;
|
2014-12-16 08:42:24 +01:00
|
|
|
|
2015-08-26 16:20:23 +02:00
|
|
|
void ToV0_2_0();
|
2015-11-11 15:26:48 +01:00
|
|
|
void ToV0_2_1();
|
2016-01-07 17:43:08 +01:00
|
|
|
void ToV0_2_4();
|
2016-04-07 18:56:41 +02:00
|
|
|
void ToV0_3_0();
|
2016-05-13 19:33:52 +02:00
|
|
|
void ToV0_3_1();
|
2016-11-08 15:32:18 +01:00
|
|
|
void ToV0_4_0();
|
2017-03-10 18:14:14 +01:00
|
|
|
void ToV0_4_4();
|
2017-08-15 10:17:54 +02:00
|
|
|
void ToV0_6_0();
|
2017-09-02 13:47:44 +02:00
|
|
|
void ToV0_6_2();
|
2022-03-25 10:15:34 +01:00
|
|
|
void ToV0_8_8();
|
2022-01-11 16:24:16 +01:00
|
|
|
void ToV0_9_0();
|
2022-08-03 19:05:09 +02:00
|
|
|
void ToV0_9_1();
|
2015-08-27 10:25:11 +02:00
|
|
|
|
|
|
|
void TagUnitToV0_2_0();
|
|
|
|
void TagIncrementToV0_2_0();
|
2015-09-07 15:51:13 +02:00
|
|
|
void ConvertMeasurementsToV0_2_0();
|
2015-08-27 10:25:11 +02:00
|
|
|
void TagMeasurementsToV0_2_0();
|
|
|
|
|
2015-11-11 15:26:48 +01:00
|
|
|
void ConvertMeasurementsToV0_2_1();
|
|
|
|
|
2016-05-19 14:40:55 +02:00
|
|
|
void RemoveColorToolCutV0_3_1();
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QSet<QString> FixIncrementsToV0_2_0();
|
|
|
|
QString FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names);
|
|
|
|
void FixPointExpressionsToV0_2_0(const QSet<QString> &names);
|
|
|
|
void FixArcExpressionsToV0_2_0(const QSet<QString> &names);
|
|
|
|
void FixPathPointExpressionsToV0_2_0(const QSet<QString> &names);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
void ConvertPointExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
|
|
|
void ConvertArcExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
|
|
|
void ConvertPathPointExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
|
|
|
QString FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names);
|
|
|
|
|
2015-08-27 10:25:11 +02:00
|
|
|
QString MUnitV0_1_4() const;
|
|
|
|
QDomElement TagMeasurementsV0_1_4() const;
|
2015-08-27 13:00:20 +02:00
|
|
|
QDomElement TagIncrementsV0_1_4() const;
|
2015-09-07 15:51:13 +02:00
|
|
|
|
2016-01-07 17:43:08 +01:00
|
|
|
void FixToolUnionToV0_2_4();
|
|
|
|
void ParseModelingToV0_2_4(const QDomElement &modeling);
|
|
|
|
void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children);
|
|
|
|
|
2015-09-07 15:51:13 +02:00
|
|
|
static QMap<QString, QString> OldNamesToNewNames_InV0_2_0();
|
2015-11-11 15:26:48 +01:00
|
|
|
static QMap<QString, QString> OldNamesToNewNames_InV0_2_1();
|
2016-08-20 16:32:45 +02:00
|
|
|
|
|
|
|
void FixCutPoint();
|
|
|
|
void FixSubPaths(int i, quint32 id, quint32 baseCurve);
|
2016-11-08 15:32:18 +01:00
|
|
|
|
2016-11-25 12:19:38 +01:00
|
|
|
void TagRemoveAttributeTypeObjectInV0_4_0();
|
2016-11-08 15:32:18 +01:00
|
|
|
void TagDetailToV0_4_0();
|
2017-01-18 14:17:16 +01:00
|
|
|
void TagUnionDetailsToV0_4_0();
|
|
|
|
QDomElement GetUnionDetailNodesV0_4_0(const QDomElement &detail);
|
|
|
|
QDomElement GetUnionChildrenNodesV0_4_0(const QDomElement &detail);
|
2017-03-14 12:54:15 +01:00
|
|
|
|
|
|
|
void LabelTagToV0_4_4(const QString &tagName);
|
2017-08-16 15:39:16 +02:00
|
|
|
|
|
|
|
QDomElement AddTagPatternLabelV0_5_1();
|
2017-08-18 08:02:03 +02:00
|
|
|
void PortPatternLabeltoV0_6_0(QDomElement &label);
|
2017-08-16 15:39:16 +02:00
|
|
|
void AddLabelTemplateLineV0_6_0(QDomElement &label, const QString &text, bool bold, bool italic, int alignment,
|
|
|
|
int fontSizeIncrement);
|
2017-08-18 08:02:03 +02:00
|
|
|
void PortPieceLabelstoV0_6_0();
|
2017-08-16 15:39:16 +02:00
|
|
|
void RemoveUnusedTagsV0_6_0();
|
|
|
|
void RemoveUniqueTagV0_6_0(const QString &tag);
|
2017-09-02 13:47:44 +02:00
|
|
|
|
|
|
|
void AddTagPreviewCalculationsV0_6_2();
|
2020-04-22 13:32:25 +02:00
|
|
|
|
2020-10-16 07:22:43 +02:00
|
|
|
void RemoveGradationV0_8_8();
|
2020-04-22 13:32:25 +02:00
|
|
|
void AddPieceUUIDV0_8_8();
|
2022-01-11 16:24:16 +01:00
|
|
|
|
|
|
|
void ConvertImageToV0_9_0();
|
2014-12-11 16:12:16 +01:00
|
|
|
};
|
|
|
|
|
2016-07-07 17:04:26 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-09-14 18:47:41 +02:00
|
|
|
inline unsigned VPatternConverter::MinVer() const
|
2016-07-07 17:04:26 +02:00
|
|
|
{
|
|
|
|
return PatternMinVer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-09-14 18:47:41 +02:00
|
|
|
inline unsigned VPatternConverter::MaxVer() const
|
2016-07-07 17:04:26 +02:00
|
|
|
{
|
|
|
|
return PatternMaxVer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline QString VPatternConverter::MinVerStr() const
|
|
|
|
{
|
|
|
|
return PatternMinVerStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline QString VPatternConverter::MaxVerStr() const
|
|
|
|
{
|
|
|
|
return PatternMaxVerStr;
|
|
|
|
}
|
|
|
|
|
2014-12-11 16:12:16 +01:00
|
|
|
#endif // VPATTERNCONVERTER_H
|