Improve dialog Increments. It should show all internal variables instead it
showed only those who were in currently selected pattern piece. --HG-- branch : develop
This commit is contained in:
parent
ab961834e8
commit
3a358f7633
|
@ -59,6 +59,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
ui(new Ui::DialogIncrements),
|
ui(new Ui::DialogIncrements),
|
||||||
data(data),
|
data(data),
|
||||||
doc(doc),
|
doc(doc),
|
||||||
|
m_completeData(doc->GetCompleteData()),
|
||||||
formulaBaseHeight(0),
|
formulaBaseHeight(0),
|
||||||
formulaBaseHeightPC(0),
|
formulaBaseHeightPC(0),
|
||||||
search(),
|
search(),
|
||||||
|
@ -220,13 +221,13 @@ void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget
|
||||||
*/
|
*/
|
||||||
void DialogIncrements::FillLengthsLines()
|
void DialogIncrements::FillLengthsLines()
|
||||||
{
|
{
|
||||||
FillTable(data->DataLengthLines(), ui->tableWidgetLines);
|
FillTable(m_completeData.DataLengthLines(), ui->tableWidgetLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIncrements::FillLengthLinesAngles()
|
void DialogIncrements::FillLengthLinesAngles()
|
||||||
{
|
{
|
||||||
FillTable(data->DataAngleLines(), ui->tableWidgetLinesAngles);
|
FillTable(m_completeData.DataAngleLines(), ui->tableWidgetLinesAngles);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -235,25 +236,25 @@ void DialogIncrements::FillLengthLinesAngles()
|
||||||
*/
|
*/
|
||||||
void DialogIncrements::FillLengthsCurves()
|
void DialogIncrements::FillLengthsCurves()
|
||||||
{
|
{
|
||||||
FillTable(data->DataLengthCurves(), ui->tableWidgetSplines);
|
FillTable(m_completeData.DataLengthCurves(), ui->tableWidgetSplines);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIncrements::FillCurvesCLengths()
|
void DialogIncrements::FillCurvesCLengths()
|
||||||
{
|
{
|
||||||
FillTable(data->DataCurvesCLength(), ui->tableWidgetCLength);
|
FillTable(m_completeData.DataCurvesCLength(), ui->tableWidgetCLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIncrements::FillRadiusesArcs()
|
void DialogIncrements::FillRadiusesArcs()
|
||||||
{
|
{
|
||||||
FillTable(data->DataRadiusesArcs(), ui->tableWidgetRadiusesArcs);
|
FillTable(m_completeData.DataRadiusesArcs(), ui->tableWidgetRadiusesArcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIncrements::FillAnglesCurves()
|
void DialogIncrements::FillAnglesCurves()
|
||||||
{
|
{
|
||||||
FillTable(data->DataAnglesCurves(), ui->tableWidgetAnglesCurves);
|
FillTable(m_completeData.DataAnglesCurves(), ui->tableWidgetAnglesCurves);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -633,6 +634,8 @@ void DialogIncrements::FullUpdateFromFile()
|
||||||
ui->tableWidgetLinesAngles->clearContents();
|
ui->tableWidgetLinesAngles->clearContents();
|
||||||
ui->tableWidgetRadiusesArcs->clearContents();
|
ui->tableWidgetRadiusesArcs->clearContents();
|
||||||
|
|
||||||
|
m_completeData = doc->GetCompleteData();
|
||||||
|
|
||||||
FillIncrements();
|
FillIncrements();
|
||||||
FillPreviewCalculations();
|
FillPreviewCalculations();
|
||||||
FillLengthsLines();
|
FillLengthsLines();
|
||||||
|
|
|
@ -87,6 +87,9 @@ private:
|
||||||
/** @brief doc dom document container */
|
/** @brief doc dom document container */
|
||||||
VPattern *doc;
|
VPattern *doc;
|
||||||
|
|
||||||
|
/** @brief m_completeData need to show all internal variables */
|
||||||
|
VContainer m_completeData;
|
||||||
|
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
int formulaBaseHeightPC;
|
int formulaBaseHeightPC;
|
||||||
|
|
||||||
|
|
|
@ -333,6 +333,40 @@ void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
||||||
tool->VDataTool::setData(data);
|
tool->VDataTool::setData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VContainer VPattern::GetCompleteData() const
|
||||||
|
{
|
||||||
|
const int countPP = CountPP();
|
||||||
|
if (countPP <= 0 || history.isEmpty() || tools.isEmpty())
|
||||||
|
{
|
||||||
|
return (data != nullptr ? *data : VContainer(nullptr, nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
const quint32 id = (countPP == 1 ? history.last().getId() : LastToolId());
|
||||||
|
|
||||||
|
if (id == NULL_ID)
|
||||||
|
{
|
||||||
|
return (data != nullptr ? *data : VContainer(nullptr, nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToolExists(id);
|
||||||
|
}
|
||||||
|
catch (VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
return (data != nullptr ? *data : VContainer(nullptr, nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
const VDataTool *vTool = tools.value(id);
|
||||||
|
VContainer lastData = vTool->getData();
|
||||||
|
//Delete special variables if exist
|
||||||
|
lastData.RemoveVariable(currentLength);
|
||||||
|
lastData.RemoveVariable(currentSeamAllowance);
|
||||||
|
return lastData;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SPointActiveDraw return id base point current pattern peace.
|
* @brief SPointActiveDraw return id base point current pattern peace.
|
||||||
|
@ -3257,6 +3291,38 @@ void VPattern::SetIncrementAttribute(const QString &name, const QString &attr, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VPattern::LastDrawName() const
|
||||||
|
{
|
||||||
|
const QDomNodeList elements = this->documentElement().elementsByTagName(TagDraw);
|
||||||
|
if (elements.size() == 0)
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDomElement &elem = elements.at(elements.size()-1).toElement();
|
||||||
|
if (not elem.isNull())
|
||||||
|
{
|
||||||
|
return GetParametrString(elem, AttrName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VPattern::LastToolId() const
|
||||||
|
{
|
||||||
|
const QString name = LastDrawName();
|
||||||
|
if (name.isEmpty())
|
||||||
|
{
|
||||||
|
return NULL_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<VToolRecord> localHistory = getLocalHistory(name);
|
||||||
|
|
||||||
|
return (not localHistory.isEmpty() ? localHistory.last().getId() : NULL_ID);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ParseSplineElement parse spline tag.
|
* @brief ParseSplineElement parse spline tag.
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
|
|
||||||
void setCurrentData();
|
void setCurrentData();
|
||||||
virtual void UpdateToolData(const quint32 &id, VContainer *data) Q_DECL_OVERRIDE;
|
virtual void UpdateToolData(const quint32 &id, VContainer *data) Q_DECL_OVERRIDE;
|
||||||
|
VContainer GetCompleteData() const;
|
||||||
|
|
||||||
virtual void IncrementReferens(quint32 id) const Q_DECL_OVERRIDE;
|
virtual void IncrementReferens(quint32 id) const Q_DECL_OVERRIDE;
|
||||||
virtual void DecrementReferens(quint32 id) const Q_DECL_OVERRIDE;
|
virtual void DecrementReferens(quint32 id) const Q_DECL_OVERRIDE;
|
||||||
|
@ -239,6 +240,9 @@ private:
|
||||||
void MoveDownIncrement(const QString &type, const QString &name);
|
void MoveDownIncrement(const QString &type, const QString &name);
|
||||||
|
|
||||||
void SetIncrementAttribute(const QString &name, const QString &attr, const QString &text);
|
void SetIncrementAttribute(const QString &name, const QString &attr, const QString &text);
|
||||||
|
|
||||||
|
QString LastDrawName() const;
|
||||||
|
quint32 LastToolId() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPATTERN_H
|
#endif // VPATTERN_H
|
||||||
|
|
|
@ -349,6 +349,21 @@ bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<VToolRecord> VAbstractPattern::getLocalHistory(const QString &draw) const
|
||||||
|
{
|
||||||
|
QVector<VToolRecord> historyPP;
|
||||||
|
for (qint32 i = 0; i< history.size(); ++i)
|
||||||
|
{
|
||||||
|
const VToolRecord &tool = history.at(i);
|
||||||
|
if (tool.getNameDraw() == draw)
|
||||||
|
{
|
||||||
|
historyPP.append(tool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return historyPP;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief CheckNameDraw check if exist pattern peace with this name.
|
* @brief CheckNameDraw check if exist pattern peace with this name.
|
||||||
|
@ -777,17 +792,7 @@ QVector<VToolRecord> *VAbstractPattern::getHistory()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
|
QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
|
||||||
{
|
{
|
||||||
QVector<VToolRecord> historyPP;
|
return getLocalHistory(GetNameActivPP());
|
||||||
for (qint32 i = 0; i< history.size(); ++i)
|
|
||||||
{
|
|
||||||
const VToolRecord tool = history.at(i);
|
|
||||||
if (tool.getNameDraw() != GetNameActivPP())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
historyPP.append(tool);
|
|
||||||
}
|
|
||||||
return historyPP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -419,6 +419,8 @@ protected:
|
||||||
|
|
||||||
int GetIndexActivPP() const;
|
int GetIndexActivPP() const;
|
||||||
bool GetActivDrawElement(QDomElement &element) const;
|
bool GetActivDrawElement(QDomElement &element) const;
|
||||||
|
|
||||||
|
QVector<VToolRecord> getLocalHistory(const QString &draw) const;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractPattern)
|
Q_DISABLE_COPY(VAbstractPattern)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user