Implicit Sharing for class VMeasurement.
--HG-- branch : develop
This commit is contained in:
parent
2557cb1133
commit
8c572ab70d
|
@ -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
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#define VCURVELENGTH_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include "../options.h"
|
||||
|
||||
class VCurveLengthData : public QSharedData
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#define VINCREMENT_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include "../options.h"
|
||||
|
||||
class VIncrementData : public QSharedData
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#define VLINEANGLE_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include "../options.h"
|
||||
|
||||
class VLineAngleData : public QSharedData
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#define VLINELENGTH_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include "../options.h"
|
||||
|
||||
class VLengthLineData : public QSharedData
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
class VMeasurementData;
|
||||
|
||||
/**
|
||||
* @brief The VMeasurement class keep data row of standard table
|
||||
*/
|
||||
|
@ -56,33 +58,9 @@ public:
|
|||
static QStringList ListHeights(QMap<GHeights, bool> heights);
|
||||
static QStringList ListSizes(QMap<GSizes, bool> sizes);
|
||||
private:
|
||||
/** @brief description description measurement */
|
||||
QString gui_text;
|
||||
QSharedDataPointer<VMeasurementData> 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
|
||||
|
|
59
src/app/container/vmeasurement_p.h
Normal file
59
src/app/container/vmeasurement_p.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vmeasurement_p.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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
|
||||
** <https://bitbucket.org/dismine/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 VMEASUREMENT_P_H
|
||||
#define VMEASUREMENT_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
|
||||
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
|
|
@ -30,7 +30,6 @@
|
|||
#define VVARIABLE_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include "../options.h"
|
||||
|
||||
class VVariableData : public QSharedData
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user