diff --git a/src/app/container/container.pri b/src/app/container/container.pri index b60b99618..758aaf921 100644 --- a/src/app/container/container.pri +++ b/src/app/container/container.pri @@ -29,4 +29,5 @@ HEADERS += \ container/vincrement_p.h \ container/vcurvelength_p.h \ container/vlineangle_p.h \ - container/vlinelength_p.h + container/vlinelength_p.h \ + container/vmeasurement_p.h diff --git a/src/app/container/vcurvelength_p.h b/src/app/container/vcurvelength_p.h index 1135bcebb..cd100266a 100644 --- a/src/app/container/vcurvelength_p.h +++ b/src/app/container/vcurvelength_p.h @@ -30,7 +30,6 @@ #define VCURVELENGTH_P_H #include -#include "../options.h" class VCurveLengthData : public QSharedData { diff --git a/src/app/container/vincrement_p.h b/src/app/container/vincrement_p.h index eab9edbd0..d7cfd1caf 100644 --- a/src/app/container/vincrement_p.h +++ b/src/app/container/vincrement_p.h @@ -30,7 +30,6 @@ #define VINCREMENT_P_H #include -#include "../options.h" class VIncrementData : public QSharedData { diff --git a/src/app/container/vlineangle_p.h b/src/app/container/vlineangle_p.h index 7345d3b7d..4ef2a6b88 100644 --- a/src/app/container/vlineangle_p.h +++ b/src/app/container/vlineangle_p.h @@ -30,7 +30,6 @@ #define VLINEANGLE_P_H #include -#include "../options.h" class VLineAngleData : public QSharedData { diff --git a/src/app/container/vlinelength_p.h b/src/app/container/vlinelength_p.h index 8388b2ba5..a880a1b89 100644 --- a/src/app/container/vlinelength_p.h +++ b/src/app/container/vlinelength_p.h @@ -30,7 +30,6 @@ #define VLINELENGTH_P_H #include -#include "../options.h" class VLengthLineData : public QSharedData { diff --git a/src/app/container/vmeasurement.cpp b/src/app/container/vmeasurement.cpp index 183876659..bb6ceceaa 100644 --- a/src/app/container/vmeasurement.cpp +++ b/src/app/container/vmeasurement.cpp @@ -27,6 +27,7 @@ *************************************************************************/ #include "vmeasurement.h" +#include "vmeasurement_p.h" #include "../widgets/vapplication.h" #include "../xml/vabstractmeasurements.h" @@ -35,7 +36,7 @@ * @brief VMeasurement create empty measurement */ VMeasurement::VMeasurement() - :VVariable(), gui_text(QString()), _tagName(QString()) + :VVariable(), d(new VMeasurementData) { SetType(VarType::Measurement); } @@ -53,7 +54,7 @@ VMeasurement::VMeasurement() */ VMeasurement::VMeasurement(const QString &name, const qreal &base, const qreal &ksize, const qreal &kheight, const QString &gui_text, const QString &description, const QString &tagName) - :VVariable(name, base, ksize, kheight, description), gui_text(gui_text), _tagName(tagName) + :VVariable(name, base, ksize, kheight, description), d(new VMeasurementData(gui_text, tagName)) { SetType(VarType::Measurement); } @@ -69,14 +70,14 @@ VMeasurement::VMeasurement(const QString &name, const qreal &base, const qreal & */ VMeasurement::VMeasurement(const QString &name, const qreal &base, const QString &gui_text, const QString &description, const QString &tagName) - :VVariable(name, base, description), gui_text(gui_text), _tagName(tagName) + :VVariable(name, base, description), d(new VMeasurementData(gui_text, tagName)) { SetType(VarType::Measurement); } //--------------------------------------------------------------------------------------------------------------------- VMeasurement::VMeasurement(const VMeasurement &m) - :VVariable(m), gui_text(m.GetGuiText()), _tagName(m.TagName()) + :VVariable(m), d(m.d) {} //--------------------------------------------------------------------------------------------------------------------- @@ -87,8 +88,7 @@ VMeasurement &VMeasurement::operator=(const VMeasurement &m) return *this; } VVariable::operator=(m); - this->gui_text = m.GetGuiText(); - this->_tagName = m.TagName(); + d = m.d; return *this; } @@ -165,3 +165,25 @@ void VMeasurement::ListValue(QStringList &list, qreal value) QString strVal = QString("%1").arg(val); list.append(strVal); } + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetGuiText measurement name for tooltip + * @return measurement name + */ +QString VMeasurement::GetGuiText() const +{ + return d->gui_text; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VMeasurement::TagName() const +{ + return d->_tagName; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurement::setTagName(const QString &tagName) +{ + d->_tagName = tagName; +} diff --git a/src/app/container/vmeasurement.h b/src/app/container/vmeasurement.h index 5bcdaede7..98ac75f08 100644 --- a/src/app/container/vmeasurement.h +++ b/src/app/container/vmeasurement.h @@ -34,6 +34,8 @@ #include +class VMeasurementData; + /** * @brief The VMeasurement class keep data row of standard table */ @@ -56,33 +58,9 @@ public: static QStringList ListHeights(QMap heights); static QStringList ListSizes(QMap sizes); private: - /** @brief description description measurement */ - QString gui_text; + QSharedDataPointer d; - QString _tagName; static void ListValue(QStringList &list, qreal value); }; -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief GetGuiText measurement name for tooltip - * @return measurement name - */ -inline QString VMeasurement::GetGuiText() const -{ - return gui_text; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline QString VMeasurement::TagName() const -{ - return _tagName; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline void VMeasurement::setTagName(const QString &tagName) -{ - _tagName = tagName; -} - #endif // VSTANDARDTABLEROW_H diff --git a/src/app/container/vmeasurement_p.h b/src/app/container/vmeasurement_p.h new file mode 100644 index 000000000..2f2d6d320 --- /dev/null +++ b/src/app/container/vmeasurement_p.h @@ -0,0 +1,59 @@ +/************************************************************************ + ** + ** @file vmeasurement_p.h + ** @author Roman Telezhynskyi + ** @date 20 8, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2014 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VMEASUREMENT_P_H +#define VMEASUREMENT_P_H + +#include + +class VMeasurementData : public QSharedData +{ +public: + + VMeasurementData() + :gui_text(QString()), _tagName(QString()) + {} + + VMeasurementData(const QString &gui_text, const QString &tagName) + :gui_text(gui_text), _tagName(tagName) + {} + + VMeasurementData(const VMeasurementData &m) + :QSharedData(m), gui_text(m.gui_text), _tagName(m._tagName) + {} + + virtual ~VMeasurementData() {} + + /** @brief description description measurement */ + QString gui_text; + + QString _tagName; +}; + + +#endif // VMEASUREMENT_P_H diff --git a/src/app/container/vvariable_p.h b/src/app/container/vvariable_p.h index 66c7d5e67..b351df6b7 100644 --- a/src/app/container/vvariable_p.h +++ b/src/app/container/vvariable_p.h @@ -30,7 +30,6 @@ #define VVARIABLE_P_H #include -#include "../options.h" class VVariableData : public QSharedData {