Added pattern piece data dialog, which can be accessed with right mouse click in Detail mode
--HG-- branch : feature
This commit is contained in:
parent
05b094deec
commit
1899abc39e
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<pattern>
|
<pattern>
|
||||||
<!--Valentina pattern format.-->
|
<!--Valentina pattern format.-->
|
||||||
<version>0.2.4</version>
|
<version>0.3.1</version>
|
||||||
<unit>cm</unit>
|
<unit>cm</unit>
|
||||||
<author/>
|
<author/>
|
||||||
<description/>
|
<description/>
|
||||||
|
@ -26,14 +26,14 @@
|
||||||
<point type="alongLine" typeLine="hair" name="M" id="15" firstPoint="6" secondPoint="11" mx="0.132292" lineColor="black" my="0.264583" length="1.15"/>
|
<point type="alongLine" typeLine="hair" name="M" id="15" firstPoint="6" secondPoint="11" mx="0.132292" lineColor="black" my="0.264583" length="1.15"/>
|
||||||
<spline point4="12" type="simple" kAsm1="1" kAsm2="0.951923" angle1="180" angle2="352.272" id="19" kCurve="1" color="black" point1="14"/>
|
<spline point4="12" type="simple" kAsm1="1" kAsm2="0.951923" angle1="180" angle2="352.272" id="19" kCurve="1" color="black" point1="14"/>
|
||||||
<spline point4="13" type="simple" kAsm1="1.03" kAsm2="0.99" angle1="0" angle2="184" id="20" kCurve="1" color="black" point1="15"/>
|
<spline point4="13" type="simple" kAsm1="1.03" kAsm2="0.99" angle1="0" angle2="184" id="20" kCurve="1" color="black" point1="15"/>
|
||||||
<point type="cutSpline" name="N" id="21" spline="19" color="black" mx="0.132292" my="0.264583" length="Spl_L_J/3"/>
|
<point type="cutSpline" name="N" id="21" spline="19" mx="0.132292" my="0.264583" length="Spl_L_J/3"/>
|
||||||
<point type="cutSpline" name="P" id="25" spline="19" color="black" mx="0.0124795" my="0.504208" length="Spl_L_J*0.66"/>
|
<point type="cutSpline" name="P" id="25" spline="19" mx="0.0124795" my="0.504208" length="Spl_L_J*0.66"/>
|
||||||
<point type="cutSpline" name="p1" id="28" spline="23" color="black" mx="-0.439814" my="-1.99663" length="(Spl_L_J - (waist_circ/4))/2"/>
|
<point type="cutSpline" name="p1" id="28" spline="23" mx="-0.439814" my="-1.99663" length="(Spl_L_J - (waist_circ/4))/2"/>
|
||||||
<point type="cutSpline" name="p2" id="31" spline="27" color="black" mx="-0.762067" my="-2.16296" length="(Spl_L_J - (waist_circ/4))/2"/>
|
<point type="cutSpline" name="p2" id="31" spline="27" mx="-0.762067" my="-2.16296" length="(Spl_L_J - (waist_circ/4))/2"/>
|
||||||
<point type="cutSpline" name="R" id="42" spline="20" color="black" mx="0.132292" my="0.264583" length="Spl_M_K/3"/>
|
<point type="cutSpline" name="R" id="42" spline="20" mx="0.132292" my="0.264583" length="Spl_M_K/3"/>
|
||||||
<point type="cutSpline" name="T" id="45" spline="20" color="black" mx="-0.378769" my="0.328469" length="Spl_M_K*0.66"/>
|
<point type="cutSpline" name="T" id="45" spline="20" mx="-0.378769" my="0.328469" length="Spl_M_K*0.66"/>
|
||||||
<point type="cutSpline" name="p5" id="48" spline="44" color="black" mx="-0.37877" my="-2.40734" length="(Spl_M_K - waist_circ/4)/2"/>
|
<point type="cutSpline" name="p5" id="48" spline="44" mx="-0.37877" my="-2.40734" length="(Spl_M_K - waist_circ/4)/2"/>
|
||||||
<point type="cutSpline" name="p6" id="51" spline="47" color="black" mx="-0.442653" my="-2.22685" length="(Spl_M_K - waist_circ/4)/2"/>
|
<point type="cutSpline" name="p6" id="51" spline="47" mx="-0.442653" my="-2.22685" length="(Spl_M_K - waist_circ/4)/2"/>
|
||||||
<point type="alongLine" typeLine="hair" name="p9" id="60" firstPoint="3" secondPoint="9" mx="0.132292" lineColor="black" my="0.264583" length="Line_C_G - 3"/>
|
<point type="alongLine" typeLine="hair" name="p9" id="60" firstPoint="3" secondPoint="9" mx="0.132292" lineColor="black" my="0.264583" length="Line_C_G - 3"/>
|
||||||
<spline point4="9" type="simple" kAsm1="1.36147" kAsm2="0.520526" angle1="291.592" angle2="91.5128" id="73" kCurve="1" color="black" point1="13"/>
|
<spline point4="9" type="simple" kAsm1="1.36147" kAsm2="0.520526" angle1="291.592" angle2="91.5128" id="73" kCurve="1" color="black" point1="13"/>
|
||||||
<point type="alongLine" typeLine="hair" name="A1" id="74" firstPoint="3" secondPoint="9" mx="0.132292" lineColor="black" my="0.264583" length="Line_C_G/2"/>
|
<point type="alongLine" typeLine="hair" name="A1" id="74" firstPoint="3" secondPoint="9" mx="0.132292" lineColor="black" my="0.264583" length="Line_C_G/2"/>
|
||||||
|
|
|
@ -628,7 +628,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
|
detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
|
||||||
}
|
}/*
|
||||||
else if (element.tagName() == TagData)
|
else if (element.tagName() == TagData)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -642,7 +642,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
catch(const VException& e)
|
catch(const VException& e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
||||||
|
|
|
@ -163,8 +163,7 @@ void VPatternConverter::ApplyPatches()
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000203):
|
case (0x000203):
|
||||||
ToV0_2_4();
|
ToV0_2_4();
|
||||||
//ValidateXML(XSDSchema(0x000204), fileName);
|
ValidateXML(XSDSchema(0x000204), fileName);
|
||||||
ValidateXML(XSDSchema(0x000302), fileName);
|
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000204):
|
case (0x000204):
|
||||||
ToV0_2_5();
|
ToV0_2_5();
|
||||||
|
|
|
@ -522,6 +522,15 @@ VPatternPieceData& VDetail::GetPatternPieceData()
|
||||||
return d->m_ppData;
|
return d->m_ppData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief Returns the read only reference to the pattern piece data object
|
||||||
|
* @return pattern piece data object
|
||||||
|
*/
|
||||||
|
const VPatternPieceData& VDetail::GetPatternPieceData() const
|
||||||
|
{
|
||||||
|
return d->m_ppData;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "../vlayout/vabstractdetail.h"
|
#include "../vlayout/vabstractdetail.h"
|
||||||
#include "vpatternpiecedata.h"
|
|
||||||
|
|
||||||
class VDetailData;
|
class VDetailData;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
class QPainterPath;
|
class QPainterPath;
|
||||||
|
class VPatternPieceData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VDetail class for path of object (points, arcs, splines).
|
* @brief The VDetail class for path of object (points, arcs, splines).
|
||||||
|
@ -86,6 +86,7 @@ public:
|
||||||
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
||||||
QVector<VNodeDetail> listNodePoint()const;
|
QVector<VNodeDetail> listNodePoint()const;
|
||||||
VPatternPieceData& GetPatternPieceData();
|
VPatternPieceData& GetPatternPieceData();
|
||||||
|
const VPatternPieceData& GetPatternPieceData() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VDetailData> d;
|
QSharedDataPointer<VDetailData> d;
|
||||||
|
|
|
@ -17,7 +17,8 @@ SOURCES += \
|
||||||
$$PWD/variables/vlinelength.cpp \
|
$$PWD/variables/vlinelength.cpp \
|
||||||
$$PWD/variables/vmeasurement.cpp \
|
$$PWD/variables/vmeasurement.cpp \
|
||||||
$$PWD/variables/vvariable.cpp \
|
$$PWD/variables/vvariable.cpp \
|
||||||
$$PWD/vformula.cpp
|
$$PWD/vformula.cpp \
|
||||||
|
$$PWD/vpatternpiecedata.cpp
|
||||||
|
|
||||||
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
||||||
|
@ -49,4 +50,5 @@ HEADERS += \
|
||||||
$$PWD/variables/vmeasurement_p.h \
|
$$PWD/variables/vmeasurement_p.h \
|
||||||
$$PWD/variables/vvariable.h \
|
$$PWD/variables/vvariable.h \
|
||||||
$$PWD/variables/vvariable_p.h \
|
$$PWD/variables/vvariable_p.h \
|
||||||
$$PWD/vformula.h
|
$$PWD/vformula.h \
|
||||||
|
$$PWD/vpatternpiecedata.h
|
||||||
|
|
|
@ -101,8 +101,3 @@ CONFIG(debug, debug|release){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
vpatternpiecedata.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
vpatternpiecedata.cpp
|
|
||||||
|
|
|
@ -29,24 +29,20 @@
|
||||||
#include "vpatternpiecedata.h"
|
#include "vpatternpiecedata.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
VPatternPieceData::VPatternPieceData()
|
VPatternPieceData::VPatternPieceData()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
VPatternPieceData::~VPatternPieceData()
|
VPatternPieceData::~VPatternPieceData()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VPatternPieceData::Append(const MaterialCutPlacement& rMCP)
|
void VPatternPieceData::Append(const MaterialCutPlacement& rMCP)
|
||||||
{
|
{
|
||||||
m_conMCP.append(rMCP);
|
m_conMCP.append(rMCP);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP)
|
void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP)
|
||||||
{
|
{
|
||||||
Q_ASSERT(i >= 0);
|
Q_ASSERT(i >= 0);
|
||||||
|
@ -55,14 +51,20 @@ void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternPieceData::Set(int i, const MaterialCutPlacement& rMCP)
|
||||||
|
{
|
||||||
|
Q_ASSERT(i >= 0);
|
||||||
|
Q_ASSERT(i < GetMCPCount());
|
||||||
|
m_conMCP[i] = rMCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VPatternPieceData::GetMCPCount() const
|
int VPatternPieceData::GetMCPCount() const
|
||||||
{
|
{
|
||||||
return m_conMCP.count();
|
return m_conMCP.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const
|
const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(i >= 0);
|
Q_ASSERT(i >= 0);
|
||||||
|
@ -71,7 +73,6 @@ const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VPatternPieceData::RemoveMCP(int i)
|
void VPatternPieceData::RemoveMCP(int i)
|
||||||
{
|
{
|
||||||
Q_ASSERT(i >= 0);
|
Q_ASSERT(i >= 0);
|
||||||
|
@ -80,28 +81,24 @@ void VPatternPieceData::RemoveMCP(int i)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QString& VPatternPieceData::GetLetter() const
|
||||||
QString VPatternPieceData::GetLetter() const
|
|
||||||
{
|
{
|
||||||
return m_qsLetter;
|
return m_qsLetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VPatternPieceData::SetLetter(QString qsLetter)
|
void VPatternPieceData::SetLetter(QString qsLetter)
|
||||||
{
|
{
|
||||||
m_qsLetter = qsLetter.left(3);
|
m_qsLetter = qsLetter.left(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QString& VPatternPieceData::GetName() const
|
||||||
QString VPatternPieceData::GetName() const
|
|
||||||
{
|
{
|
||||||
return m_qsName;
|
return m_qsName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VPatternPieceData::SetName(QString qsName)
|
void VPatternPieceData::SetName(QString qsName)
|
||||||
{
|
{
|
||||||
m_qsName = qsName;
|
m_qsName = qsName;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#ifndef VPATTERNPIECEDATA_H
|
|
||||||
#define VPATTERNPIECEDATA_H
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file vpatternpiecedata.h
|
** @file vpatternpiecedata.h
|
||||||
|
@ -29,6 +26,9 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VPATTERNPIECEDATA_H
|
||||||
|
#define VPATTERNPIECEDATA_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
@ -69,14 +69,15 @@ public:
|
||||||
// methods, which operate on MaterialCutPlacement container
|
// methods, which operate on MaterialCutPlacement container
|
||||||
void Append(const MaterialCutPlacement& rMCP);
|
void Append(const MaterialCutPlacement& rMCP);
|
||||||
void Insert(int i, const MaterialCutPlacement& rMCP);
|
void Insert(int i, const MaterialCutPlacement& rMCP);
|
||||||
|
void Set(int i, const MaterialCutPlacement& rMCP);
|
||||||
int GetMCPCount() const;
|
int GetMCPCount() const;
|
||||||
const MaterialCutPlacement& GetMCP(int i) const;
|
const MaterialCutPlacement& GetMCP(int i) const;
|
||||||
void RemoveMCP(int i);
|
void RemoveMCP(int i);
|
||||||
|
|
||||||
// methods, which operate on other members
|
// methods, which operate on other members
|
||||||
QString GetLetter() const;
|
const QString& GetLetter() const;
|
||||||
void SetLetter(QString qsLetter);
|
void SetLetter(QString qsLetter);
|
||||||
QString GetName() const;
|
const QString& GetName() const;
|
||||||
void SetName(QString qsName);
|
void SetName(QString qsName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -38,7 +38,9 @@ HEADERS += \
|
||||||
$$PWD/tools/dialogcubicbezier.h \
|
$$PWD/tools/dialogcubicbezier.h \
|
||||||
$$PWD/tools/dialogcubicbezierpath.h \
|
$$PWD/tools/dialogcubicbezierpath.h \
|
||||||
$$PWD/tools/dialoggroup.h \
|
$$PWD/tools/dialoggroup.h \
|
||||||
$$PWD/tools/dialogrotation.h
|
$$PWD/tools/dialogrotation.h \
|
||||||
|
$$PWD/tools/dialogpatternpiecedata.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/tools/dialogalongline.cpp \
|
$$PWD/tools/dialogalongline.cpp \
|
||||||
|
@ -76,7 +78,8 @@ SOURCES += \
|
||||||
$$PWD/tools/dialogcubicbezier.cpp \
|
$$PWD/tools/dialogcubicbezier.cpp \
|
||||||
$$PWD/tools/dialogcubicbezierpath.cpp \
|
$$PWD/tools/dialogcubicbezierpath.cpp \
|
||||||
$$PWD/tools/dialoggroup.cpp \
|
$$PWD/tools/dialoggroup.cpp \
|
||||||
$$PWD/tools/dialogrotation.cpp
|
$$PWD/tools/dialogrotation.cpp \
|
||||||
|
$$PWD/tools/dialogpatternpiecedata.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tools/dialogalongline.ui \
|
$$PWD/tools/dialogalongline.ui \
|
||||||
|
|
250
src/libs/vtools/dialogs/tools/dialogpatternpiecedata.cpp
Normal file
250
src/libs/vtools/dialogs/tools/dialogpatternpiecedata.cpp
Normal file
|
@ -0,0 +1,250 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vpatternconverter.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 11 12, 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) 2013-2015 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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QGroupBox>
|
||||||
|
|
||||||
|
#include "vpatternpiecedata.h"
|
||||||
|
#include "dialogpatternpiecedata.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogPatternPieceData::DialogPatternPieceData(const VContainer *data, const quint32 &toolId, QWidget *parent) :
|
||||||
|
DialogTool(data, toolId, parent)
|
||||||
|
{
|
||||||
|
// main dialog layout
|
||||||
|
QVBoxLayout* pLayout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
// widgets layout
|
||||||
|
QHBoxLayout* pWidgetsLayout = new QHBoxLayout;
|
||||||
|
|
||||||
|
setWindowTitle(tr("Pattern piece data"));
|
||||||
|
QFormLayout* pFormLayout = new QFormLayout;
|
||||||
|
QLabel* plb;
|
||||||
|
|
||||||
|
plb = new QLabel(tr("Letter") + ":");
|
||||||
|
m_pleLetter = new QLineEdit;
|
||||||
|
m_pleLetter->setMaxLength(3);
|
||||||
|
pFormLayout->addRow(plb, m_pleLetter);
|
||||||
|
|
||||||
|
plb = new QLabel(tr("Name") + ":");
|
||||||
|
m_pleName = new QLineEdit;
|
||||||
|
m_pleName->setMaxLength(15);
|
||||||
|
pFormLayout->addRow(plb, m_pleName);
|
||||||
|
|
||||||
|
pWidgetsLayout->addLayout(pFormLayout);
|
||||||
|
|
||||||
|
QGroupBox* pgb = new QGroupBox(tr("Material/Cut number/Placement"));
|
||||||
|
QGridLayout* pLayoutGB = new QGridLayout(pgb);
|
||||||
|
|
||||||
|
pFormLayout = new QFormLayout;
|
||||||
|
|
||||||
|
plb = new QLabel(tr("Material type") + ":");
|
||||||
|
m_pcbMaterial = new QComboBox;
|
||||||
|
m_pcbMaterial->setFixedWidth(200);
|
||||||
|
m_qslMaterials << tr("Fabric") << tr("Lining") << tr("Interfacing") << tr("Interlining");
|
||||||
|
m_pcbMaterial->addItems(m_qslMaterials);
|
||||||
|
m_pcbMaterial->setEditable(true);
|
||||||
|
pFormLayout->addRow(plb, m_pcbMaterial);
|
||||||
|
|
||||||
|
plb = new QLabel(tr("Cut number") + ":");
|
||||||
|
m_psbCutNumber = new QSpinBox;
|
||||||
|
m_psbCutNumber->setRange(0, 1000);
|
||||||
|
pFormLayout->addRow(plb, m_psbCutNumber);
|
||||||
|
|
||||||
|
plb = new QLabel(tr("Placement type") + ":");
|
||||||
|
m_pcbPlacement = new QComboBox;
|
||||||
|
m_qslPlacements << tr("None") << tr("Cut on fold");
|
||||||
|
m_pcbPlacement->addItems(m_qslPlacements);
|
||||||
|
pFormLayout->addRow(plb, m_pcbPlacement);
|
||||||
|
pLayoutGB->addLayout(pFormLayout, 0, 0);
|
||||||
|
|
||||||
|
QHBoxLayout* pMCPButtonLayout = new QHBoxLayout;
|
||||||
|
m_pbOpAddUpdate = new QPushButton;
|
||||||
|
connect(m_pbOpAddUpdate, &QPushButton::clicked, this, &DialogPatternPieceData::AddUpdate);
|
||||||
|
pMCPButtonLayout->addStretch(1);
|
||||||
|
pMCPButtonLayout->addWidget(m_pbOpAddUpdate);
|
||||||
|
m_pbOpCancel = new QPushButton(tr("Cancel"));
|
||||||
|
connect(m_pbOpCancel, &QPushButton::clicked, this, &DialogPatternPieceData::Cancel);
|
||||||
|
pMCPButtonLayout->addWidget(m_pbOpCancel);
|
||||||
|
m_pbOpRemove = new QPushButton(tr("Remove"));
|
||||||
|
connect(m_pbOpRemove, &QPushButton::clicked, this, &DialogPatternPieceData::Remove);
|
||||||
|
pMCPButtonLayout->addWidget(m_pbOpRemove);
|
||||||
|
pLayoutGB->addLayout(pMCPButtonLayout, 1, 0);
|
||||||
|
|
||||||
|
m_plwMCP = new QListWidget;
|
||||||
|
connect(m_plwMCP, &QListWidget::itemClicked, this, &DialogPatternPieceData::SetEditMode);
|
||||||
|
pLayoutGB->addWidget(m_plwMCP, 0, 1, 3, 1);
|
||||||
|
pLayoutGB->setRowStretch(2, 1);
|
||||||
|
pLayoutGB->setColumnStretch(2, 1);
|
||||||
|
|
||||||
|
pWidgetsLayout->addWidget(pgb);
|
||||||
|
|
||||||
|
pWidgetsLayout->setStretch(2, 1);
|
||||||
|
|
||||||
|
pLayout->addLayout(pWidgetsLayout);
|
||||||
|
|
||||||
|
QHBoxLayout* pButtonsLayout = new QHBoxLayout;
|
||||||
|
pButtonsLayout->addStretch(0);
|
||||||
|
bOk = new QPushButton(tr("OK"));
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
||||||
|
QPushButton* pbCancel = new QPushButton(tr("Cancel"));
|
||||||
|
connect(pbCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||||
|
pButtonsLayout->addWidget(bOk);
|
||||||
|
pButtonsLayout->addWidget(pbCancel);
|
||||||
|
|
||||||
|
pLayout->addLayout(pButtonsLayout);
|
||||||
|
pLayout->setStretch(0, 1);
|
||||||
|
|
||||||
|
SetAddMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::SetDetail(const VDetail& rDetail)
|
||||||
|
{
|
||||||
|
m_detail = rDetail;
|
||||||
|
m_pleLetter->setText(m_detail.GetPatternPieceData().GetLetter());
|
||||||
|
m_pleName->setText(m_detail.GetPatternPieceData().GetName());
|
||||||
|
UpdateList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::SaveData()
|
||||||
|
{
|
||||||
|
m_detail.GetPatternPieceData().SetLetter(m_pleLetter->text());
|
||||||
|
m_detail.GetPatternPieceData().SetName(m_pleName->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::UpdateList()
|
||||||
|
{
|
||||||
|
m_plwMCP->clear();
|
||||||
|
for (int i = 0; i < m_detail.GetPatternPieceData().GetMCPCount(); ++i)
|
||||||
|
{
|
||||||
|
MaterialCutPlacement mcp = m_detail.GetPatternPieceData().GetMCP(i);
|
||||||
|
QString qsText = tr("Cut %1 of %2%3");
|
||||||
|
qsText = qsText.arg(mcp.m_iCutNumber);
|
||||||
|
if (mcp.m_eMaterial < MaterialType::mtUserDefined)
|
||||||
|
qsText = qsText.arg(m_qslMaterials[int(mcp.m_eMaterial)]);
|
||||||
|
else
|
||||||
|
qsText = qsText.arg(mcp.m_qsMaterialUserDef);
|
||||||
|
if (mcp.m_ePlacement == PlacementType::ptCutOnFold)
|
||||||
|
qsText = qsText.arg(tr(" on Fold"));
|
||||||
|
else
|
||||||
|
qsText = qsText.arg("");
|
||||||
|
|
||||||
|
m_plwMCP->addItem(qsText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::AddUpdate()
|
||||||
|
{
|
||||||
|
MaterialCutPlacement mcp;
|
||||||
|
mcp.m_qsMaterialUserDef = m_pcbMaterial->currentText();
|
||||||
|
mcp.m_eMaterial = MaterialType::mtUserDefined;
|
||||||
|
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
||||||
|
if (mcp.m_qsMaterialUserDef == m_qslMaterials[i])
|
||||||
|
mcp.m_eMaterial = MaterialType(i);
|
||||||
|
|
||||||
|
mcp.m_iCutNumber = m_psbCutNumber->value();
|
||||||
|
mcp.m_ePlacement = PlacementType(m_pcbPlacement->currentIndex());
|
||||||
|
|
||||||
|
if (m_bAddMode == true)
|
||||||
|
{
|
||||||
|
m_detail.GetPatternPieceData().Append(mcp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int iR = m_plwMCP->currentRow();
|
||||||
|
SCASSERT(iR >= 0);
|
||||||
|
m_detail.GetPatternPieceData().Set(iR, mcp);
|
||||||
|
SetAddMode();
|
||||||
|
}
|
||||||
|
UpdateList();
|
||||||
|
ClearFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::Cancel()
|
||||||
|
{
|
||||||
|
ClearFields();
|
||||||
|
SetAddMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::Remove()
|
||||||
|
{
|
||||||
|
int iR = m_plwMCP->currentRow();
|
||||||
|
SCASSERT(iR >= 0);
|
||||||
|
m_detail.GetPatternPieceData().RemoveMCP(iR);
|
||||||
|
UpdateList();
|
||||||
|
ClearFields();
|
||||||
|
SetAddMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::ClearFields()
|
||||||
|
{
|
||||||
|
m_pcbMaterial->setCurrentIndex(0);
|
||||||
|
m_psbCutNumber->setValue(0);
|
||||||
|
m_pcbPlacement->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::SetAddMode()
|
||||||
|
{
|
||||||
|
m_pbOpAddUpdate->setText(tr("Add"));
|
||||||
|
m_pbOpCancel->hide();
|
||||||
|
m_pbOpRemove->hide();
|
||||||
|
m_plwMCP->setCurrentRow(-1);
|
||||||
|
m_bAddMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternPieceData::SetEditMode()
|
||||||
|
{
|
||||||
|
int iR = m_plwMCP->currentRow();
|
||||||
|
// this method can be called by clicking on item or by update. In the latter case there is nothing else to do!
|
||||||
|
if (iR < 0 || iR >= m_detail.GetPatternPieceData().GetMCPCount())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_pbOpAddUpdate->setText(tr("Update"));
|
||||||
|
m_pbOpCancel->show();
|
||||||
|
m_pbOpRemove->show();
|
||||||
|
|
||||||
|
MaterialCutPlacement mcp = m_detail.GetPatternPieceData().GetMCP(iR);
|
||||||
|
m_pcbMaterial->setCurrentText(mcp.m_qsMaterialUserDef);
|
||||||
|
m_psbCutNumber->setValue(mcp.m_iCutNumber);
|
||||||
|
m_pcbPlacement->setCurrentIndex(int(mcp.m_ePlacement));
|
||||||
|
|
||||||
|
m_bAddMode = false;
|
||||||
|
}
|
94
src/libs/vtools/dialogs/tools/dialogpatternpiecedata.h
Normal file
94
src/libs/vtools/dialogs/tools/dialogpatternpiecedata.h
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vpatternconverter.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 11 12, 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) 2013-2015 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 DIALOGPATTERNPIECEDATA_H
|
||||||
|
#define DIALOGPATTERNPIECEDATA_H
|
||||||
|
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QListWidget>
|
||||||
|
|
||||||
|
#include "vdetail.h"
|
||||||
|
#include "dialogtool.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This dialog allows user to edit pattern piece meta data
|
||||||
|
*/
|
||||||
|
class DialogPatternPieceData : public DialogTool
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DialogPatternPieceData(const VContainer* data, const quint32& toolId, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
VDetail GetDetail() const;
|
||||||
|
void SetDetail(const VDetail& rDetail);
|
||||||
|
|
||||||
|
void SaveData();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void UpdateList();
|
||||||
|
void AddUpdate();
|
||||||
|
void Cancel();
|
||||||
|
void Remove();
|
||||||
|
|
||||||
|
private:
|
||||||
|
VDetail m_detail;
|
||||||
|
|
||||||
|
QLineEdit* m_pleName;
|
||||||
|
QLineEdit* m_pleLetter;
|
||||||
|
QComboBox* m_pcbMaterial;
|
||||||
|
QSpinBox* m_psbCutNumber;
|
||||||
|
QComboBox* m_pcbPlacement;
|
||||||
|
|
||||||
|
QPushButton* m_pbOpAddUpdate;
|
||||||
|
QPushButton* m_pbOpCancel;
|
||||||
|
QPushButton* m_pbOpRemove;
|
||||||
|
|
||||||
|
QListWidget* m_plwMCP;
|
||||||
|
|
||||||
|
QStringList m_qslMaterials;
|
||||||
|
QStringList m_qslPlacements;
|
||||||
|
|
||||||
|
bool m_bAddMode;
|
||||||
|
|
||||||
|
void ClearFields();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void SetAddMode();
|
||||||
|
void SetEditMode();
|
||||||
|
};
|
||||||
|
|
||||||
|
inline VDetail DialogPatternPieceData::GetDetail() const
|
||||||
|
{
|
||||||
|
return m_detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DIALOGPATTERNPIECEDATA_H
|
|
@ -36,10 +36,12 @@
|
||||||
#include "../vwidgets/vmaingraphicsview.h"
|
#include "../vwidgets/vmaingraphicsview.h"
|
||||||
#include "../dialogs/tools/dialogtool.h"
|
#include "../dialogs/tools/dialogtool.h"
|
||||||
#include "../dialogs/tools/dialogdetail.h"
|
#include "../dialogs/tools/dialogdetail.h"
|
||||||
|
#include "../dialogs/tools/dialogpatternpiecedata.h"
|
||||||
#include "../undocommands/savedetailoptions.h"
|
#include "../undocommands/savedetailoptions.h"
|
||||||
#include "../undocommands/movedetail.h"
|
#include "../undocommands/movedetail.h"
|
||||||
#include "../undocommands/adddet.h"
|
#include "../undocommands/adddet.h"
|
||||||
#include "../undocommands/deletedetail.h"
|
#include "../undocommands/deletedetail.h"
|
||||||
|
#include "vpatternpiecedata.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
@ -293,10 +295,21 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SCASSERT(dialog != nullptr);
|
SCASSERT(dialog != nullptr);
|
||||||
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
|
VDetail newDet;
|
||||||
SCASSERT(dialogTool != nullptr);
|
|
||||||
VDetail newDet = dialogTool->getDetail();
|
|
||||||
VDetail oldDet = VAbstractTool::data.GetDetail(id);
|
VDetail oldDet = VAbstractTool::data.GetDetail(id);
|
||||||
|
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
|
||||||
|
//SCASSERT(dialogTool != nullptr);
|
||||||
|
|
||||||
|
if (dialogTool != nullptr)
|
||||||
|
{
|
||||||
|
newDet = dialogTool->getDetail();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DialogPatternPieceData* dialogPPD = qobject_cast<DialogPatternPieceData*>(dialog);
|
||||||
|
SCASSERT(dialogPPD != nullptr);
|
||||||
|
newDet = dialogPPD->GetDetail();
|
||||||
|
}
|
||||||
|
|
||||||
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
|
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
|
||||||
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||||
|
@ -518,7 +531,7 @@ void VToolDetail::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolDetail::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolDetail::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
@ -538,6 +551,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||||
|
QAction* actionData = menu.addAction(tr("Details info"));
|
||||||
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
if (_referens > 1)
|
if (_referens > 1)
|
||||||
{
|
{
|
||||||
|
@ -558,7 +572,17 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
setDialog();
|
setDialog();
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
if (selectedAction == actionRemove)
|
else if (selectedAction == actionData)
|
||||||
|
{
|
||||||
|
dialog = new DialogPatternPieceData(getData(), id, qApp->getMainWindow());
|
||||||
|
dialog->setModal(true);
|
||||||
|
|
||||||
|
connect(dialog, &DialogTool::DialogClosed, this, &VToolDetail::FullUpdateFromGuiOk);
|
||||||
|
VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
|
qobject_cast<DialogPatternPieceData*>(dialog)->SetDetail(detail);
|
||||||
|
dialog->show();
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionRemove)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user