diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp new file mode 100644 index 000000000..078a8b157 --- /dev/null +++ b/src/libs/vlayout/vabstractdetail.cpp @@ -0,0 +1,168 @@ +/************************************************************************ + ** + ** @file vabstractdetail.cpp + ** @author Roman Telezhynskyi + ** @date 2 1, 2015 + ** + ** @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) 2015 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 . + ** + *************************************************************************/ + +#include "vabstractdetail.h" +#include "vabstractdetail_p.h" + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VAbstractDetail default contructor. Create empty detail. + */ +VAbstractDetail::VAbstractDetail() + :d(new VAbstractDetailData) +{} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VAbstractDetail constructor. + * @param name detail name. + */ +VAbstractDetail::VAbstractDetail(const QString &name) + :d(new VAbstractDetailData(name)) +{} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VAbstractDetail copy constructor. + * @param detail detail. + */ +VAbstractDetail::VAbstractDetail(const VAbstractDetail &detail) + :d (detail.d) +{} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief operator = assignment operator. + * @param detail detail. + * @return new detail. + */ +VAbstractDetail &VAbstractDetail::operator=(const VAbstractDetail &detail) +{ + if ( &detail == this ) + { + return *this; + } + d = detail.d; + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractDetail::~VAbstractDetail() +{} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Clear detail full clear. + */ +void VAbstractDetail::Clear() +{ + d->name.clear(); + d->seamAllowance = false; + d->closed = true; + d->width = 0; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief getName return detail name. + * @return name. + */ +QString VAbstractDetail::getName() const +{ + return d->name; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief setName set detail name. + * @param value new name. + */ +void VAbstractDetail::setName(const QString &value) +{ + d->name = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief getSeamAllowance keep status for seam allowance detail. + * @return true - need seam allowance, false - no need seam allowance. + */ +bool VAbstractDetail::getSeamAllowance() const +{ + return d->seamAllowance; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief setSeamAllowance set status for seam allowance detail. + * @param value true - need seam allowance, false - no need seam allowance. + */ +void VAbstractDetail::setSeamAllowance(bool value) +{ + d->seamAllowance = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief getClosed keep close status for detail equdistant. + * @return true - close equdistant, false - don't close equdistant. + */ +bool VAbstractDetail::getClosed() const +{ + return d->closed; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief setClosed set close status for detail equdistant. + * @param value true - close equdistant, false - don't close equdistant. + */ +void VAbstractDetail::setClosed(bool value) +{ + d->closed = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief getWidth return value detail seam allowance. + * @return value in mm. + */ +qreal VAbstractDetail::getWidth() const +{ + return d->width; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief setWidth set value detail seam allowance. + * @param value width in mm. + */ +void VAbstractDetail::setWidth(const qreal &value) +{ + d->width = value; +} diff --git a/src/libs/vlayout/vabstractdetail.h b/src/libs/vlayout/vabstractdetail.h new file mode 100644 index 000000000..046793bce --- /dev/null +++ b/src/libs/vlayout/vabstractdetail.h @@ -0,0 +1,66 @@ +/************************************************************************ + ** + ** @file vabstractdetail.h + ** @author Roman Telezhynskyi + ** @date 2 1, 2015 + ** + ** @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) 2015 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 VABSTRACTDETAIL_H +#define VABSTRACTDETAIL_H + +#include + +class QString; +class VAbstractDetailData; + +/** + * @brief The VAbstractDetail class abstract class for all details. + */ +class VAbstractDetail +{ +public: + VAbstractDetail(); + VAbstractDetail(const QString &name); + VAbstractDetail(const VAbstractDetail &detail); + VAbstractDetail &operator=(const VAbstractDetail &detail); + ~VAbstractDetail(); + + void Clear(); + + QString getName() const; + void setName(const QString &value); + + bool getSeamAllowance() const; + void setSeamAllowance(bool value); + + bool getClosed() const; + void setClosed(bool value); + + qreal getWidth() const; + void setWidth(const qreal &value); +private: + QSharedDataPointer d; +}; + +#endif // VABSTRACTDETAIL_H diff --git a/src/libs/vlayout/vabstractdetail_p.h b/src/libs/vlayout/vabstractdetail_p.h new file mode 100644 index 000000000..17826ed76 --- /dev/null +++ b/src/libs/vlayout/vabstractdetail_p.h @@ -0,0 +1,71 @@ +/************************************************************************ + ** + ** @file vabstractdetail_p.h + ** @author Roman Telezhynskyi + ** @date 2 1, 2015 + ** + ** @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) 2015 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 VABSTRACTDETAIL_P_H +#define VABSTRACTDETAIL_P_H + +#include + +#ifdef Q_CC_GNU + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Weffc++" +#endif + +class VAbstractDetailData : public QSharedData +{ +public: + VAbstractDetailData() + :name(QString()), seamAllowance(false), closed(true), width(0) + {} + + VAbstractDetailData(const QString &name) + :name(name), seamAllowance(false), closed(true), width(0) + {} + + VAbstractDetailData(const VAbstractDetailData &detail) + :QSharedData(detail), name(detail.name), seamAllowance(detail.seamAllowance), closed(detail.closed), + width(detail.width) + {} + + ~VAbstractDetailData() {} + + /** @brief name detail name. */ + QString name; + /** @brief seamAllowance status seamAllowance detail. */ + bool seamAllowance; + /** @brief closed status equdistant detail. */ + bool closed; + /** @brief width value seamAllowance in mm. */ + qreal width; +}; + +#ifdef Q_CC_GNU + #pragma GCC diagnostic pop +#endif + +#endif // VABSTRACTDETAIL_P_H diff --git a/src/libs/vlayout/vlayout.pri b/src/libs/vlayout/vlayout.pri index 0bd4da172..2e203b6e1 100644 --- a/src/libs/vlayout/vlayout.pri +++ b/src/libs/vlayout/vlayout.pri @@ -4,9 +4,12 @@ HEADERS += \ $$PWD/stable.h \ $$PWD/vlayoutgenerator.h \ - $$PWD/vlayoutdetail.h + $$PWD/vlayoutdetail.h \ + $$PWD/vabstractdetail.h \ + $$PWD/vabstractdetail_p.h SOURCES += \ $$PWD/stable.cpp \ $$PWD/vlayoutgenerator.cpp \ - $$PWD/vlayoutdetail.cpp + $$PWD/vlayoutdetail.cpp \ + $$PWD/vabstractdetail.cpp