1 /************************************************************************ 2 ** 3 ** @file vwatermarkconverter.cpp 4 ** @author Roman Telezhynskyi <dismine(at)gmail.com> 5 ** @date 26 12, 2019 6 ** 7 ** @brief 8 ** @copyright 9 ** This source code is part of the Valentina project, a pattern making 10 ** program, whose allow create and modeling patterns of clothing. 11 ** Copyright (C) 2019 Valentina project 12 ** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved. 13 ** 14 ** Valentina is free software: you can redistribute it and/or modify 15 ** it under the terms of the GNU General Public License as published by 16 ** the Free Software Foundation, either version 3 of the License, or 17 ** (at your option) any later version. 18 ** 19 ** Valentina is distributed in the hope that it will be useful, 20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 ** GNU General Public License for more details. 23 ** 24 ** You should have received a copy of the GNU General Public License 25 ** along with Valentina. If not, see <http://www.gnu.org/licenses/>. 26 ** 27 *************************************************************************/ 28 #include "vwatermarkconverter.h" 29 30 /* 31 * Version rules: 32 * 1. Version have three parts "major.minor.patch"; 33 * 2. major part only for stable releases; 34 * 3. minor - 10 or more patch changes, or one big change; 35 * 4. patch - little change. 36 */ 37 38 const QString VWatermarkConverter::WatermarkMinVerStr = QStringLiteral("1.0.0"); 39 const QString VWatermarkConverter::WatermarkMaxVerStr = QStringLiteral("1.0.0"); 40 const QString VWatermarkConverter::CurrentSchema = QStringLiteral("://schema/watermark/v1.0.0.xsd"); 41 42 //VWatermarkConverter::WatermarkMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! 43 //VWatermarkConverter::WatermarkMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! 44 45 //--------------------------------------------------------------------------------------------------------------------- VWatermarkConverter(const QString & fileName)46VWatermarkConverter::VWatermarkConverter(const QString &fileName) 47 : VAbstractConverter(fileName) 48 { 49 ValidateInputFile(CurrentSchema); 50 } 51 52 //--------------------------------------------------------------------------------------------------------------------- MinVer() const53int VWatermarkConverter::MinVer() const 54 { 55 return WatermarkMinVer; 56 } 57 58 //--------------------------------------------------------------------------------------------------------------------- MaxVer() const59int VWatermarkConverter::MaxVer() const 60 { 61 return WatermarkMaxVer; 62 } 63 64 //--------------------------------------------------------------------------------------------------------------------- MinVerStr() const65QString VWatermarkConverter::MinVerStr() const 66 { 67 return WatermarkMinVerStr; 68 } 69 70 //--------------------------------------------------------------------------------------------------------------------- MaxVerStr() const71QString VWatermarkConverter::MaxVerStr() const 72 { 73 return WatermarkMaxVerStr; 74 } 75 76 //--------------------------------------------------------------------------------------------------------------------- XSDSchema(int ver) const77QString VWatermarkConverter::XSDSchema(int ver) const 78 { 79 switch (ver) 80 { 81 case (0x010000): 82 return CurrentSchema; 83 default: 84 InvalidVersion(ver); 85 break; 86 } 87 return QString();//unreachable code 88 } 89 90 //--------------------------------------------------------------------------------------------------------------------- ApplyPatches()91void VWatermarkConverter::ApplyPatches() 92 { 93 switch (m_ver) 94 { 95 case (0x010000): 96 break; 97 default: 98 InvalidVersion(m_ver); 99 break; 100 } 101 } 102 103 //--------------------------------------------------------------------------------------------------------------------- DowngradeToCurrentMaxVersion()104void VWatermarkConverter::DowngradeToCurrentMaxVersion() 105 { 106 SetVersion(WatermarkMaxVerStr); 107 Save(); 108 } 109