valentina/src/libs/ifc/xml/vpatternconverter.h

182 lines
6.1 KiB
C
Raw Normal View History

/************************************************************************
**
** @file vpatternconverter.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 11 12, 2014
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** 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
#include <QCoreApplication>
#include <QDomElement>
#include <QMap>
#include <QSet>
#include <QString>
#include <QStringList>
#include <QVector>
#include <QtGlobal>
2023-02-10 13:14:43 +01:00
#include "../vmisc/projectversion.h"
2023-10-02 14:22:13 +02:00
#include "vabstractconverter.h"
class QDomElement;
class VPatternConverter final : public VAbstractConverter
{
2022-08-12 17:50:13 +02:00
Q_DECLARE_TR_FUNCTIONS(VPatternConverter) // NOLINT
2023-10-02 14:22:13 +02:00
public:
2015-10-12 13:52:48 +02:00
explicit VPatternConverter(const QString &fileName);
2022-08-22 15:36:01 +02:00
virtual ~VPatternConverter() = default;
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);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 2);
2023-10-02 14:22:13 +02:00
static auto XSDSchemas() -> QHash<unsigned, QString>;
2023-02-10 13:14:43 +01:00
protected:
2022-02-18 15:32:43 +01:00
void Save() override;
2023-05-03 13:07:02 +02:00
virtual auto MinVer() const -> unsigned override;
virtual auto MaxVer() const -> unsigned override;
2023-05-03 13:07:02 +02:00
virtual auto MinVerStr() const -> QString override;
virtual auto MaxVerStr() const -> QString override;
2023-02-10 13:14:43 +01:00
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
2023-05-03 13:07:02 +02:00
virtual auto IsReadOnly() const -> bool override;
2023-10-02 14:22:13 +02:00
auto Schemas() const -> QHash<unsigned, QString> override;
2023-02-10 13:14:43 +01:00
private:
2022-08-12 17:50:13 +02:00
Q_DISABLE_COPY_MOVE(VPatternConverter) // NOLINT
static const QString PatternMinVerStr;
void ToV0_2_0();
void ToV0_2_1();
void ToV0_2_4();
void ToV0_3_0();
void ToV0_3_1();
void ToV0_4_0();
void ToV0_4_4();
void ToV0_6_0();
void ToV0_6_2();
2022-03-25 10:15:34 +01:00
void ToV0_8_8();
void ToV0_9_0();
2022-08-03 19:05:09 +02:00
void ToV0_9_1();
void ToV0_9_2();
2023-10-02 14:22:13 +02:00
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();
void ConvertMeasurementsToV0_2_0();
void TagMeasurementsToV0_2_0();
2023-10-02 14:22:13 +02:00
void ConvertMeasurementsToV0_2_1();
2023-10-02 14:22:13 +02:00
void RemoveColorToolCutV0_3_1();
2023-05-03 13:07:02 +02:00
auto FixIncrementsToV0_2_0() -> QSet<QString>;
auto FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names) -> QString;
2023-10-02 14:22:13 +02:00
void FixPointExpressionsToV0_2_0(const QSet<QString> &names);
void FixArcExpressionsToV0_2_0(const QSet<QString> &names);
void FixPathPointExpressionsToV0_2_0(const QSet<QString> &names);
2023-10-02 14:22: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);
2023-05-03 13:07:02 +02:00
auto FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names) -> QString;
2023-05-03 13:07:02 +02:00
auto MUnitV0_1_4() const -> QString;
auto TagMeasurementsV0_1_4() const -> QDomElement;
auto TagIncrementsV0_1_4() const -> QDomElement;
void FixToolUnionToV0_2_4();
void ParseModelingToV0_2_4(const QDomElement &modeling);
void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children);
2023-05-03 13:07:02 +02:00
static auto OldNamesToNewNames_InV0_2_0() -> QMap<QString, QString>;
static auto OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>;
void FixCutPoint();
void FixSubPaths(int i, quint32 id, quint32 baseCurve);
void TagRemoveAttributeTypeObjectInV0_4_0();
void TagDetailToV0_4_0();
void TagUnionDetailsToV0_4_0();
2023-05-03 13:07:02 +02:00
auto GetUnionDetailNodesV0_4_0(const QDomElement &detail) -> QDomElement;
auto GetUnionChildrenNodesV0_4_0(const QDomElement &detail) -> QDomElement;
void LabelTagToV0_4_4(const QString &tagName);
2023-05-03 13:07:02 +02:00
auto AddTagPatternLabelV0_5_1() -> QDomElement;
void PortPatternLabeltoV0_6_0(QDomElement &label);
void AddLabelTemplateLineV0_6_0(QDomElement &label, const QString &text, bool bold, bool italic, int alignment,
int fontSizeIncrement);
void PortPieceLabelstoV0_6_0();
void RemoveUnusedTagsV0_6_0();
void RemoveUniqueTagV0_6_0(const QString &tag);
void AddTagPreviewCalculationsV0_6_2();
2020-04-22 13:32:25 +02:00
void RemoveGradationV0_8_8();
2020-04-22 13:32:25 +02:00
void AddPieceUUIDV0_8_8();
void ConvertImageToV0_9_0();
2022-08-06 12:33:07 +02:00
void ConvertMeasurementsPathToV0_9_1();
2022-11-14 17:02:00 +01:00
void ConvertPathAttributesToV0_9_2();
};
//---------------------------------------------------------------------------------------------------------------------
2023-05-03 13:07:02 +02:00
inline auto VPatternConverter::MinVer() const -> unsigned
{
return PatternMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
2023-05-03 13:07:02 +02:00
inline auto VPatternConverter::MaxVer() const -> unsigned
{
return PatternMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
2023-05-03 13:07:02 +02:00
inline auto VPatternConverter::MinVerStr() const -> QString
{
return PatternMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
2023-05-03 13:07:02 +02:00
inline auto VPatternConverter::MaxVerStr() const -> QString
{
return PatternMaxVerStr;
}
#endif // VPATTERNCONVERTER_H