Merge with develop
--HG-- branch : feature
3
AUTHORS
|
@ -6,3 +6,6 @@ Our Team:
|
|||
(*) Christine Neupert <enaisoc@googlemail.com>
|
||||
Testing, translation.
|
||||
|
||||
(*) Patrick Proy <patrick@proy.org>
|
||||
Developing.
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ void VContainer::setData(const VContainer &data)
|
|||
qDeleteAll(gObjects);
|
||||
gObjects.clear();
|
||||
const QHash<quint32, VGObject*> *obj = data.DataGObjects();
|
||||
Q_CHECK_PTR(obj);
|
||||
SCASSERT(obj != nullptr);
|
||||
QHashIterator<quint32, VGObject*> i(*obj);
|
||||
while (i.hasNext())
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ template <typename val>
|
|||
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
|
||||
{
|
||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||
Q_CHECK_PTR(point);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setId(id);
|
||||
if (gObjects.contains(id))
|
||||
{
|
||||
|
@ -542,7 +542,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint
|
|||
template <typename key, typename val>
|
||||
quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
|
||||
{
|
||||
Q_CHECK_PTR(value);
|
||||
SCASSERT(value != nullptr);
|
||||
quint32 id = getNextId();
|
||||
value->setId(id);
|
||||
obj[id] = value;
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
try
|
||||
{
|
||||
T obj = dynamic_cast<T>(gObj);
|
||||
Q_CHECK_PTR(obj);
|
||||
SCASSERT(obj != nullptr);
|
||||
return obj;
|
||||
}
|
||||
catch (const std::bad_alloc &)
|
||||
|
|
|
@ -65,7 +65,7 @@ DialogAboutApp::~DialogAboutApp()
|
|||
*/
|
||||
void DialogAboutApp::webButtonClicked()
|
||||
{
|
||||
if ( ! QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)))
|
||||
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Cannot open your default browser"));
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAboutApp;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ void DialogHistory::FillTable()
|
|||
{
|
||||
ui->tableWidget->clear();
|
||||
const QVector<VToolRecord> *history = doc->getHistory();
|
||||
Q_CHECK_PTR(history);
|
||||
SCASSERT(history != nullptr);
|
||||
qint32 currentRow = -1;
|
||||
qint32 count = 0;
|
||||
ui->tableWidget->setRowCount(history->size());
|
||||
|
@ -187,7 +187,7 @@ void DialogHistory::FillTable()
|
|||
{
|
||||
cursorRow = currentRow;
|
||||
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
|
||||
Q_CHECK_PTR(item);
|
||||
SCASSERT(item != nullptr);
|
||||
item->setIcon(QIcon("://icon/32x32/put_after.png"));
|
||||
}
|
||||
ui->tableWidget->resizeColumnsToContents();
|
||||
|
@ -289,7 +289,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
case Valentina::SplineTool:
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(tool.getId());
|
||||
Q_CHECK_PTR(spl);
|
||||
SCASSERT(spl != nullptr);
|
||||
const QString splP1Name = data->GeometricObject<const VPointF *>(spl->GetP1().id())->name();
|
||||
const QString splP4Name = data->GeometricObject<const VPointF *>(spl->GetP4().id())->name();
|
||||
return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name);
|
||||
|
@ -297,14 +297,14 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
case Valentina::ArcTool:
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(tool.getId());
|
||||
Q_CHECK_PTR(arc);
|
||||
SCASSERT(arc != nullptr);
|
||||
const QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name();
|
||||
return QString(tr("Arc with center in point %1")).arg(arcCenterName);
|
||||
}
|
||||
case Valentina::SplinePathTool:
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(tool.getId());
|
||||
Q_CHECK_PTR(splPath);
|
||||
SCASSERT(splPath != nullptr);
|
||||
const QVector<VSplinePoint> points = splPath->GetSplinePath();
|
||||
QString record;
|
||||
if (points.size() != 0 )
|
||||
|
@ -375,7 +375,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
{
|
||||
const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(arcId);
|
||||
Q_CHECK_PTR(arc);
|
||||
SCASSERT(arc != nullptr);
|
||||
const QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name();
|
||||
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName);
|
||||
|
@ -384,7 +384,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
{
|
||||
const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
|
||||
Q_CHECK_PTR(spl);
|
||||
SCASSERT(spl != nullptr);
|
||||
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
const QString splP1Name = data->GeometricObject<const VPointF *>(spl->GetP1().id())->name();
|
||||
const QString splP4Name = data->GeometricObject<const VPointF *>(spl->GetP4().id())->name();
|
||||
|
@ -394,7 +394,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
{
|
||||
const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
|
||||
Q_CHECK_PTR(splPath);
|
||||
SCASSERT(splPath != nullptr);
|
||||
const QVector<VSplinePoint> points = splPath->GetSplinePath();
|
||||
QString record;
|
||||
if (points.size() != 0 )
|
||||
|
|
|
@ -50,6 +50,10 @@ public:
|
|||
virtual ~DialogHistory();
|
||||
public slots:
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
void cellClicked(int row, int column);
|
||||
void ChangedCursor(quint32 id);
|
||||
void UpdateHistory();
|
||||
|
|
|
@ -49,6 +49,10 @@ public:
|
|||
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
|
||||
~DialogIncrements();
|
||||
public slots:
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
void clickedToolButtonAdd();
|
||||
void clickedToolButtonRemove();
|
||||
void IncrementChanged ( qint32 row, qint32 column );
|
||||
|
|
|
@ -44,12 +44,12 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
|
|||
|
||||
{
|
||||
const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogAccepted);
|
||||
}
|
||||
{
|
||||
const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
SCASSERT(bCansel != nullptr);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected);
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ void DialogIndividualMeasurements::CheckState()
|
|||
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagName && flagPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
Q_CHECK_PTR(doc);
|
||||
SCASSERT(doc != nullptr);
|
||||
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
|
@ -52,11 +52,11 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
|
|||
ui->plainTextEditTechNotes->setPlainText(this->doc->UniqueTagText("notes"));
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogPatternProperties::Apply);
|
||||
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
SCASSERT(bCansel != nullptr);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close);
|
||||
|
||||
connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange);
|
||||
|
|
1259
src/app/dialogs/app/dialogpatternxmledit.cpp
Normal file
388
src/app/dialogs/app/dialogpatternxmledit.h
Normal file
|
@ -0,0 +1,388 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpatternxmledit.h
|
||||
** @author Patrick Proy <patrick(at)proy.org>
|
||||
** @date 14 5, 2014
|
||||
**
|
||||
** @brief Include file for the XML editor dialog
|
||||
** @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 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 DIALOGPATTERNXMLEDIT_H
|
||||
#define DIALOGPATTERNXMLEDIT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStandardItemModel>
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
//********************************************************************************************
|
||||
/**
|
||||
* @brief The vXMLTreeElement class : node/attribute of xml pattern. Used by vXMLTreeView
|
||||
*
|
||||
*/
|
||||
|
||||
#define BACKGROUND_COLOR_ATTRIBUTE QBrush(Qt::GlobalColor::cyan)
|
||||
#define BACKGROUND_COLOR_INACTIVE_NODE QBrush(Qt::GlobalColor::gray)
|
||||
class VXMLTreeElement : public QStandardItem
|
||||
{
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief vXMLTreeElement
|
||||
* @param name : display name
|
||||
* @param nodetype : node type (node, attribute, root)
|
||||
* @param source : the source dom node
|
||||
*/
|
||||
explicit VXMLTreeElement (QString name, short int nodetype, QDomNode source, bool editor);
|
||||
|
||||
explicit VXMLTreeElement (QString name, int nodetype);
|
||||
|
||||
~VXMLTreeElement ();
|
||||
static const short int TypeNode;
|
||||
static const short int TypeAttr;
|
||||
static const short int TypeRoot;
|
||||
/**
|
||||
* @brief setNodeValue : set value of node (content or attribute)
|
||||
* @param value : the value
|
||||
*/
|
||||
void SetTreeNodeValue(QString value);
|
||||
/**
|
||||
* @brief displayText : text to display
|
||||
* @return text to display
|
||||
*/
|
||||
QString DisplayText();
|
||||
/**
|
||||
* @brief getDocNode
|
||||
* @return current document node
|
||||
*/
|
||||
QDomNode GetDocNode();
|
||||
/**
|
||||
* @brief SetDocNode set tree element DomNode
|
||||
* @param node
|
||||
*/
|
||||
inline void SetDocNode(QDomNode node)
|
||||
{
|
||||
this->DocNode=node;
|
||||
}
|
||||
inline void SetAddedNode(bool state) {this->addedNode=state;}
|
||||
inline bool GetAddedNode() {return this->addedNode;}
|
||||
|
||||
QString GettreeNodeName();
|
||||
QString GettreeNodeValue();
|
||||
/**
|
||||
* @brief GettreeNodeValueSet check if value has been set
|
||||
* @return true if value is set
|
||||
*/
|
||||
bool GettreeNodeValueSet();
|
||||
void SetTreeNodeName(QString value);
|
||||
/**
|
||||
* @brief getelementType
|
||||
* @return elementType value
|
||||
*/
|
||||
short int GetelementType();
|
||||
bool IsSelectable();
|
||||
void SetSetlectable(bool value);
|
||||
|
||||
inline void SetFatherElement(VXMLTreeElement* parent)
|
||||
{
|
||||
this->parentnode=parent;
|
||||
}
|
||||
inline VXMLTreeElement* GetFatherElement()
|
||||
{
|
||||
return this->parentnode;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief DocNode : link to current document node
|
||||
*/
|
||||
QDomNode DocNode;
|
||||
|
||||
/**
|
||||
* @brief parentnode parent node of this element. If null then the DocNode must be valid
|
||||
*/
|
||||
VXMLTreeElement* parentnode;
|
||||
|
||||
/**
|
||||
* @brief addedNode : true if node is added by editor (implies empty DocNode)
|
||||
*/
|
||||
bool addedNode;
|
||||
/**
|
||||
* @brief type : element type (node, attribute, text value of node)
|
||||
*/
|
||||
short int elementType;
|
||||
/**
|
||||
* @brief nodeValue : Attribute or node value
|
||||
*/
|
||||
QString treeNodeValue;
|
||||
/**
|
||||
* @brief treeNodeValueSet : true if value has been set
|
||||
*/
|
||||
bool treeNodeValueSet;
|
||||
/**
|
||||
* @brief nodeValue : Attribute or node value
|
||||
*/
|
||||
QString treeNodeName;
|
||||
/**
|
||||
* @brief selectable : can item be selected to be changed (ex : false if father deleted).
|
||||
*/
|
||||
bool selectable;
|
||||
Q_DISABLE_COPY(VXMLTreeElement)
|
||||
};
|
||||
|
||||
inline bool VXMLTreeElement::IsSelectable()
|
||||
{
|
||||
return this->selectable;
|
||||
}
|
||||
|
||||
inline void VXMLTreeElement::SetSetlectable(bool value)
|
||||
{
|
||||
this->selectable=value;
|
||||
}
|
||||
|
||||
inline short int VXMLTreeElement::GetelementType()
|
||||
{
|
||||
return this->elementType;
|
||||
}
|
||||
|
||||
inline QDomNode VXMLTreeElement::GetDocNode()
|
||||
{
|
||||
return this->DocNode;
|
||||
}
|
||||
|
||||
inline QString VXMLTreeElement::GettreeNodeName()
|
||||
{
|
||||
return this->treeNodeName;
|
||||
}
|
||||
|
||||
inline bool VXMLTreeElement::GettreeNodeValueSet()
|
||||
{
|
||||
return this->treeNodeValueSet;
|
||||
}
|
||||
|
||||
//********************************************************************************************
|
||||
/**
|
||||
* @brief The vXMLTreeView class : container to display/edit xml pattern
|
||||
*/
|
||||
class VXMLTreeView : public QStandardItemModel
|
||||
{
|
||||
public:
|
||||
explicit VXMLTreeView (QObject *parent = 0);
|
||||
void appendchain(VXMLTreeElement* elmt);
|
||||
|
||||
/**
|
||||
* @brief The TreeElement struct : chained list of vXMLTreeElement
|
||||
*/
|
||||
typedef struct TreeElementchain
|
||||
{
|
||||
VXMLTreeElement* elmt;
|
||||
TreeElementchain* next;
|
||||
} TreeElementchain;
|
||||
|
||||
TreeElementchain * getCurrent();
|
||||
void SetCurrent(TreeElementchain * value);
|
||||
TreeElementchain * GetLast();
|
||||
TreeElementchain * GetItems();
|
||||
/**
|
||||
* @brief clearTree : clear tree elements and listed items.
|
||||
*/
|
||||
void ClearTree();
|
||||
~VXMLTreeView ();
|
||||
private:
|
||||
Q_DISABLE_COPY(VXMLTreeView)
|
||||
|
||||
/**
|
||||
* @brief items : root of chained list of vXMLTreeElement
|
||||
*/
|
||||
TreeElementchain * items;
|
||||
/**
|
||||
* @brief current : used to parse in iteration.
|
||||
*/
|
||||
TreeElementchain * current;
|
||||
/**
|
||||
* @brief last : used to parse in iteration.
|
||||
*/
|
||||
TreeElementchain * last;
|
||||
};
|
||||
|
||||
inline VXMLTreeView::TreeElementchain * VXMLTreeView::getCurrent()
|
||||
{
|
||||
return this->current;
|
||||
}
|
||||
inline void VXMLTreeView::SetCurrent(VXMLTreeView::TreeElementchain * value)
|
||||
{
|
||||
this->current=value;
|
||||
}
|
||||
inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetLast()
|
||||
{
|
||||
return this->last;
|
||||
}
|
||||
inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetItems()
|
||||
{
|
||||
return this->items;
|
||||
}
|
||||
|
||||
//********************************************************************************************
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPatternXmlEdit;
|
||||
}
|
||||
/**
|
||||
* @brief The DialogPatternXmlEdit class : ui dialog for XML editing of pattern
|
||||
*/
|
||||
class DialogPatternXmlEdit : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogPatternXmlEdit(QWidget *parent = 0, VPattern *xmldoc = 0);
|
||||
~DialogPatternXmlEdit();
|
||||
|
||||
/**
|
||||
* @brief clear_edit_data : clear input boxes and disables buttons.
|
||||
*/
|
||||
void ClearEditData();
|
||||
|
||||
void NameTextEdited(QString newtext);
|
||||
void ValueTextEdited(QString newtext);
|
||||
void ButtonSetClicked();
|
||||
void ButtonCancelClicked();
|
||||
void ButtonDeleteAttributeClicked();
|
||||
void ButtonAddSonClicked();
|
||||
void ButtonAddAttributeClicked();
|
||||
void ButtonApplyChangesClicked();
|
||||
void ButtonUndoLastChange();
|
||||
void ButtonDeleteNode();
|
||||
|
||||
// Stack of changes definition
|
||||
typedef struct ChangesStackElement
|
||||
{
|
||||
short int type;
|
||||
VXMLTreeElement *element;
|
||||
QString *newText;
|
||||
QString *oldText;
|
||||
bool changedText;
|
||||
QString *newValue;
|
||||
QString *oldValue;
|
||||
bool changedValue;
|
||||
ChangesStackElement* next;
|
||||
} ChangesStackElement;
|
||||
|
||||
// Change stack functions
|
||||
ChangesStackElement* CreateStackElement(short int typechange);
|
||||
void RemoveChangeStackElement(ChangesStackElement* elmt);
|
||||
void ClearStack();
|
||||
bool treeChange;
|
||||
VXMLTreeElement* currentNodeEdited;
|
||||
short int currentNodeEditedStatus;
|
||||
ChangesStackElement* currentNodeEditedStack;
|
||||
/**
|
||||
* @brief UndoChange : undo change in change stack element
|
||||
* @param current : change to undo
|
||||
* @return true if undo has been done, false on error
|
||||
*/
|
||||
bool UndoChange(ChangesStackElement* current);
|
||||
/**
|
||||
* @brief DeleteNodeAndSons : delete node and all it's attribute and sons below
|
||||
* @param currentNode : node to delete
|
||||
* @param onlydeactivate : if true, dont delete just deactivate sons and attributes
|
||||
* @return false if changes couldn't be done
|
||||
*/
|
||||
bool DeleteNodeAndSons(VXMLTreeElement *currentNode, bool onlydeactivate);
|
||||
|
||||
/**
|
||||
* @brief ApplyAttributeChange change or add attribute for node
|
||||
* @param domElement : node containing attribute
|
||||
* @param name
|
||||
* @param value
|
||||
* @return true on success
|
||||
*/
|
||||
bool ApplyAttributeChange(QDomNode domElement, QString name, QString value);
|
||||
/**
|
||||
* @brief ApplyNodeChange Change name or text content of node
|
||||
* @param domElement node
|
||||
* @param name
|
||||
* @param value text content of node
|
||||
* @return true on success
|
||||
*/
|
||||
bool ApplyNodeChange(QDomNode domElement, QString name, QString value);
|
||||
/**
|
||||
* @brief ApplyNodeAdd add node as child of domElement and set DocNode of treeElement
|
||||
* @param domElement
|
||||
* @param treeElement the XMLTreeElement of added node
|
||||
* @param name
|
||||
* @param value
|
||||
* @return true on success
|
||||
*/
|
||||
bool ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value);
|
||||
/**
|
||||
* @brief ApplyAttributeDelete delete attribute for node
|
||||
* @param domElement
|
||||
* @param name attribute name
|
||||
* @return true on success
|
||||
*/
|
||||
bool ApplyAttributeDelete(QDomNode domElement, QString name);
|
||||
/**
|
||||
* @brief ApplyNodeDelete delete node domElement
|
||||
* @param domElement
|
||||
* @return true on success
|
||||
*/
|
||||
bool ApplyNodeDelete(QDomNode domElement);
|
||||
/**
|
||||
* @brief CheckChanges Check if changes made are OK
|
||||
* @param message error message returned if false
|
||||
* @param testRoot root of DOM to test
|
||||
* @return true if validated, false otherwise
|
||||
*/
|
||||
bool CheckChanges(QString &message, QDomNode testRoot);
|
||||
private slots:
|
||||
void BaseSelectionChanged(int value);
|
||||
void ElementClicked ( const QModelIndex & index );
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPatternXmlEdit)
|
||||
Ui::DialogPatternXmlEdit *ui;
|
||||
|
||||
VPattern *doc;
|
||||
|
||||
QDomElement root;
|
||||
QStandardItem *rootNode;
|
||||
//typedef struct rootbases { vXMLTreeElement * root; QString name; } rootbases;
|
||||
VXMLTreeElement ** rootBases;
|
||||
qint16 rootBasesNum;
|
||||
|
||||
void ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXMLTreeView *xmlmodel, bool refresh);
|
||||
VXMLTreeView* xmlmodel;
|
||||
|
||||
|
||||
// Stack of changes
|
||||
static const short int ChangeTypeDelete;
|
||||
static const short int ChangeTypeAdd;
|
||||
static const short int ChangeTypeModify;
|
||||
|
||||
// Stack of changes
|
||||
|
||||
ChangesStackElement* changeStackRoot;
|
||||
ChangesStackElement* changeStackLast;
|
||||
};
|
||||
|
||||
#endif // DIALOGPATTERNXMLEDIT_H
|
367
src/app/dialogs/app/dialogpatternxmledit.ui
Normal file
|
@ -0,0 +1,367 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogPatternXmlEdit</class>
|
||||
<widget class="QDialog" name="DialogPatternXmlEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>664</width>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>XML Editor</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeView_main">
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0" columnminimumwidth="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_Value">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Value :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit_Value">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit_Name">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_Name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_type_value">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><No selection></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_type_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type : </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Add_attribute">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add attribute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_Add_son">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add son</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Remove_attribute">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove attibute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_Remove_Node">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove node</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Set_Values">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_Cancel_Values">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Apply_Changes">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pushButton_Undo_Last_Change">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Undo last</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_Apply_Changes">
|
||||
<property name="text">
|
||||
<string>Immediate apply</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_Base_Selection">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Base selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="comboBox_Base_Selection"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogPatternXmlEdit</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -42,12 +42,12 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
|
|||
|
||||
{
|
||||
const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogAccepted);
|
||||
}
|
||||
{
|
||||
const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
SCASSERT(bCansel != nullptr);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ void DialogStandardMeasurements::CheckState()
|
|||
bool flagTable = false;
|
||||
{
|
||||
const QComboBox *box = ui->comboBoxTables;
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
if (box->count() > 0 && box->currentIndex() != -1)
|
||||
{
|
||||
flagTable = true;
|
||||
|
@ -129,7 +129,7 @@ void DialogStandardMeasurements::CheckState()
|
|||
}
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagTable && flagName);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,5 +58,6 @@
|
|||
#include "app/dialogindividualmeasurements.h"
|
||||
#include "app/dialogstandardmeasurements.h"
|
||||
#include "app/dialogaboutapp.h"
|
||||
#include "app/dialogpatternxmledit.h"
|
||||
|
||||
#endif // DIALOGS_H
|
||||
|
|
|
@ -30,7 +30,8 @@ HEADERS += \
|
|||
dialogs/app/dialogstandardmeasurements.h \
|
||||
dialogs/app/dialogindividualmeasurements.h \
|
||||
dialogs/app/dialogaboutapp.h \
|
||||
dialogs/tools/dialogeditwrongformula.h
|
||||
dialogs/tools/dialogeditwrongformula.h \
|
||||
dialogs/app/dialogpatternxmledit.h
|
||||
|
||||
SOURCES += \
|
||||
dialogs/tools/dialogtriangle.cpp \
|
||||
|
@ -63,6 +64,7 @@ SOURCES += \
|
|||
dialogs/app/dialogstandardmeasurements.cpp \
|
||||
dialogs/app/dialogindividualmeasurements.cpp \
|
||||
dialogs/app/dialogaboutapp.cpp \
|
||||
dialogs/app/dialogpatternxmledit.cpp \
|
||||
dialogs/tools/dialogeditwrongformula.cpp
|
||||
|
||||
FORMS += \
|
||||
|
@ -93,4 +95,5 @@ FORMS += \
|
|||
dialogs/app/dialogstandardmeasurements.ui \
|
||||
dialogs/app/dialogindividualmeasurements.ui \
|
||||
dialogs/app/dialogaboutapp.ui \
|
||||
dialogs/app/dialogpatternxmledit.ui \
|
||||
dialogs/tools/dialogeditwrongformula.ui
|
||||
|
|
|
@ -38,17 +38,19 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
lineEditFormula = ui->lineEditFormula;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
CheckState();
|
||||
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
|
@ -60,9 +62,38 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
|
|||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
|
||||
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogAlongLine::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogAlongLine::DeployFormulaTextEdit);
|
||||
InitVariables(ui);
|
||||
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAlongLine::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAlongLine::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGALONLINE_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGALONLINE_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -108,13 +139,26 @@ void DialogAlongLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
|||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
*/
|
||||
void DialogAlongLine::DialogAccepted()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAlongLine::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAlongLine::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->lineEditFormula->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -147,7 +191,12 @@ void DialogAlongLine::setFirstPointId(const quint32 &value, const quint32 &id)
|
|||
void DialogAlongLine::setFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
ui->lineEditFormula->setText(formula);
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGALONLINE_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAlongLine;
|
||||
|
@ -62,6 +63,18 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogAlongLine)
|
||||
|
||||
|
@ -85,6 +98,14 @@ private:
|
|||
|
||||
/** @brief secondPointId id second point of line */
|
||||
quint32 secondPointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -74,11 +74,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="toolTip">
|
||||
<string>Formula for the calculation of length of line</string>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -150,6 +156,55 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../share/resources/theme.qrc">
|
||||
<normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
@ -390,14 +445,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditFormula</tabstop>
|
||||
<tabstop>toolButtonEqual</tabstop>
|
||||
<tabstop>lineEditNamePoint</tabstop>
|
||||
<tabstop>comboBoxFirstPoint</tabstop>
|
||||
|
@ -414,6 +468,7 @@
|
|||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../share/resources/icon.qrc"/>
|
||||
<include location="../../share/resources/theme.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
*/
|
||||
DialogArc::DialogArc(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
||||
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()), f2(QString())
|
||||
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()),
|
||||
f2(QString()), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -55,7 +56,9 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
|
|||
timerF2 = new QTimer(this);
|
||||
connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2);
|
||||
|
||||
InitOkCansel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
|
||||
|
@ -71,9 +74,32 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
|
|||
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);
|
||||
connect(ui->toolButtonEqualF2, &QPushButton::clicked, this, &DialogArc::EvalF2);
|
||||
|
||||
connect(ui->lineEditRadius, &QLineEdit::textChanged, this, &DialogArc::RadiusChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
|
||||
connect(ui->lineEditF1, &QLineEdit::textChanged, this, &DialogArc::F1Changed);
|
||||
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogArc::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArc::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGARC_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGARC_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -123,7 +149,12 @@ void DialogArc::SetF1(const QString &value)
|
|||
void DialogArc::SetRadius(const QString &value)
|
||||
{
|
||||
radius = value;
|
||||
ui->lineEditRadius->setText(radius);
|
||||
// increase height if needed.
|
||||
if (radius.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(radius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -150,11 +181,24 @@ void DialogArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
|||
*/
|
||||
void DialogArc::DialogAccepted()
|
||||
{
|
||||
radius = ui->lineEditRadius->text();
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArc::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArc::SaveData()
|
||||
{
|
||||
radius = ui->plainTextEditFormula->toPlainText();
|
||||
radius.replace("\n"," ");
|
||||
f1 = ui->lineEditF1->text();
|
||||
f2 = ui->lineEditF2->text();
|
||||
center = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -185,7 +229,7 @@ void DialogArc::ValChenged(int row)
|
|||
*/
|
||||
void DialogArc::PutRadius()
|
||||
{
|
||||
PutValHere(ui->lineEditRadius, ui->listWidget);
|
||||
PutValHere(ui->plainTextEditFormula, ui->listWidget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -223,7 +267,7 @@ void DialogArc::LineAngles()
|
|||
void DialogArc::RadiusChanged()
|
||||
{
|
||||
labelEditFormula = ui->labelEditRadius;
|
||||
ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius);
|
||||
ValFormulaChanged(flagRadius, ui->plainTextEditFormula, timerRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -252,8 +296,10 @@ void DialogArc::F2Changed()
|
|||
*/
|
||||
void DialogArc::CheckState()
|
||||
{
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagRadius && flagF1 && flagF2);
|
||||
SCASSERT(bApply != nullptr);
|
||||
bApply->setEnabled(flagRadius && flagF1 && flagF2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -263,7 +309,7 @@ void DialogArc::CheckState()
|
|||
void DialogArc::EvalRadius()
|
||||
{
|
||||
labelEditFormula = ui->labelEditRadius;
|
||||
Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius);
|
||||
Eval(ui->plainTextEditFormula, flagRadius, timerRadius, ui->labelResultRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -296,7 +342,7 @@ void DialogArc::ShowLineAngles()
|
|||
ui->listWidget->clear();
|
||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
||||
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
|
||||
Q_CHECK_PTR(lineAnglesTable);
|
||||
SCASSERT(lineAnglesTable != nullptr);
|
||||
QHashIterator<QString, qreal> i(*lineAnglesTable);
|
||||
while (i.hasNext())
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGARC_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogArc;
|
||||
|
@ -60,6 +61,14 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
virtual void ValChenged(int row);
|
||||
void PutRadius();
|
||||
void PutF1();
|
||||
|
@ -107,10 +116,17 @@ private:
|
|||
/** @brief f2 formula of second angle */
|
||||
QString f2;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
void EvalRadius();
|
||||
void EvalF1();
|
||||
void EvalF2();
|
||||
void ShowLineAngles();
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelEditRadius">
|
||||
<property name="sizePolicy">
|
||||
|
@ -74,15 +77,48 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditRadius">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula for the calculation of radius of arc</string>
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down.png">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -580,14 +616,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditRadius</tabstop>
|
||||
<tabstop>lineEditF1</tabstop>
|
||||
<tabstop>lineEditF2</tabstop>
|
||||
<tabstop>comboBoxBasePoint</tabstop>
|
||||
|
|
|
@ -39,16 +39,19 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
lineEditFormula = ui->lineEditFormula;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
@ -63,7 +66,36 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
|
|||
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
|
||||
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGBISECTOR_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGBISECTOR_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -152,7 +184,12 @@ void DialogBisector::setTypeLine(const QString &value)
|
|||
void DialogBisector::setFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
ui->lineEditFormula->setText(formula);
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -193,12 +230,25 @@ void DialogBisector::setThirdPointId(const quint32 &value, const quint32 &id)
|
|||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
*/
|
||||
void DialogBisector::DialogAccepted()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->lineEditFormula->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
thirdPointId = getCurrentObjectId(ui->comboBoxThirdPoint);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGBISECTOR_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogBisector;
|
||||
|
@ -67,6 +68,18 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogBisector)
|
||||
|
||||
|
@ -93,6 +106,14 @@ private:
|
|||
|
||||
/** @brief thirdPointId id of third point */
|
||||
quint32 thirdPointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -71,17 +71,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Calculation of length of bisector by using the formula</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -147,6 +147,54 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_formula">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down.png"/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
@ -429,14 +477,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditFormula</tabstop>
|
||||
<tabstop>lineEditNamePoint</tabstop>
|
||||
<tabstop>comboBoxFirstPoint</tabstop>
|
||||
<tabstop>comboBoxSecondPoint</tabstop>
|
||||
|
|
|
@ -38,20 +38,22 @@
|
|||
* @param data container with data
|
||||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
|
||||
DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0)
|
||||
DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent)
|
||||
: DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0),
|
||||
formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
lineEditFormula = ui->lineEditFormula;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCansel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
FillComboBoxArcs(ui->comboBoxArc);
|
||||
|
||||
|
@ -60,7 +62,36 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
|
|||
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutArc::EvalFormula);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
|
||||
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutArc::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutArc::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGCUTARC_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGCUTARC_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -92,12 +123,25 @@ void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
|||
*/
|
||||
void DialogCutArc::DialogAccepted()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
formula = ui->lineEditFormula->text();
|
||||
arcId = getCurrentObjectId(ui->comboBoxArc);
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
arcId = getCurrentObjectId(ui->comboBoxArc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setArcId set id of arc
|
||||
|
@ -117,7 +161,12 @@ void DialogCutArc::setArcId(const quint32 &value, const quint32 &id)
|
|||
void DialogCutArc::setFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
ui->lineEditFormula->setText(formula);
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGCUTARC_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogCutArc;
|
||||
|
@ -43,6 +44,7 @@ class DialogCutArc : public DialogTool
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
DialogCutArc(const VContainer *data, QWidget *parent = nullptr);
|
||||
~DialogCutArc();
|
||||
|
||||
|
@ -57,6 +59,18 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCutArc)
|
||||
/** @brief ui keeps information about user interface */
|
||||
|
@ -70,6 +84,13 @@ private:
|
|||
|
||||
/** @brief arcId keep id of arc */
|
||||
quint32 arcId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -67,17 +67,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula for the calculation of the spline</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -140,6 +140,56 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_formula">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down.png">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
@ -353,7 +403,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -47,7 +47,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
|
|||
lineEditFormula = ui->lineEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
|
|
|
@ -57,6 +57,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCutSpline)
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
|
|||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
|
|
@ -57,6 +57,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCutSplinePath)
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
|
|||
labelEditNamePoint = ui.labelEditNameDetail;
|
||||
|
||||
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
||||
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
SCASSERT(bCansel != nullptr);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
|
||||
flagName = true;//We have default name of detail.
|
||||
|
@ -221,7 +221,7 @@ void DialogDetail::BiasXChanged(qreal d)
|
|||
{
|
||||
qint32 row = ui.listWidget->currentRow();
|
||||
QListWidgetItem *item = ui.listWidget->item( row );
|
||||
Q_CHECK_PTR(item);
|
||||
SCASSERT(item != nullptr);
|
||||
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||
node.setMx(qApp->toPixel(d));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||
|
@ -236,7 +236,7 @@ void DialogDetail::BiasYChanged(qreal d)
|
|||
{
|
||||
qint32 row = ui.listWidget->currentRow();
|
||||
QListWidgetItem *item = ui.listWidget->item( row );
|
||||
Q_CHECK_PTR(item);
|
||||
SCASSERT(item != nullptr);
|
||||
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||
node.setMy(qApp->toPixel(d));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||
|
|
|
@ -47,6 +47,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
void BiasXChanged(qreal d);
|
||||
void BiasYChanged(qreal d);
|
||||
void ClickedSeams(bool checked);
|
||||
|
|
|
@ -39,7 +39,7 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *
|
|||
lineEditFormula = ui->lineEditFormula;
|
||||
labelEditFormula = ui->labelFormula;
|
||||
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
flagFormula = false;
|
||||
CheckState();
|
||||
|
||||
|
@ -83,7 +83,7 @@ void DialogEditWrongFormula::DialogRejected()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEditWrongFormula::CheckState()
|
||||
{
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagFormula);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,17 +39,19 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), angle(0), basePointId(0)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), formula(QString()),
|
||||
angle(0), basePointId(0), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
lineEditFormula = ui->lineEditFormula;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCansel(ui);
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
@ -63,7 +65,37 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
|
|||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
|
||||
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEndLine::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEndLine::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGENDLINE_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGENDLINE_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -113,7 +145,16 @@ void DialogEndLine::setTypeLine(const QString &value)
|
|||
void DialogEndLine::setFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
ui->lineEditFormula->setText(formula);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
// of this PlainTextEdit to change 80 to this value
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
//QTextCursor cursor = ui->plainTextEditFormula->textCursor();
|
||||
//cursor.insertText(value);
|
||||
//ui->plainTextEditFormula->setCursor(cursor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -143,13 +184,26 @@ void DialogEndLine::setBasePointId(const quint32 &value, const quint32 &id)
|
|||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
*/
|
||||
void DialogEndLine::DialogAccepted()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEndLine::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEndLine::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->lineEditFormula->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
angle = ui->doubleSpinBoxAngle->value();
|
||||
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
|
||||
#define DIALOGENDLINE_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogEndLine;
|
||||
|
@ -63,6 +65,18 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogEndLine)
|
||||
|
||||
|
@ -83,6 +97,13 @@ private:
|
|||
|
||||
/** @brief basePointId id base point of line */
|
||||
quint32 basePointId;
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>584</width>
|
||||
<height>718</height>
|
||||
<width>486</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -80,17 +80,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula for calculation of length of line</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -153,6 +153,58 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>4</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../share/resources/theme.qrc">
|
||||
<normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
@ -594,14 +646,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditFormula</tabstop>
|
||||
<tabstop>comboBoxBasePoint</tabstop>
|
||||
<tabstop>lineEditNamePoint</tabstop>
|
||||
<tabstop>doubleSpinBoxAngle</tabstop>
|
||||
|
@ -626,6 +677,7 @@
|
|||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../share/resources/icon.qrc"/>
|
||||
<include location="../../share/resources/theme.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
|
|
@ -44,7 +44,7 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogHeight)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
|
|||
:DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
|
|
|
@ -57,6 +57,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogLine)
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent
|
|||
{
|
||||
ui->setupUi(this);
|
||||
number = 0;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
flagName = false;
|
||||
|
||||
|
@ -209,7 +209,7 @@ void DialogLineIntersect::P2Line2Changed(int index)
|
|||
*/
|
||||
void DialogLineIntersect::CheckState()
|
||||
{
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagName && flagPoint);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
void P1Line1Changed( int index);
|
||||
void P2Line1Changed( int index);
|
||||
void P1Line2Changed( int index);
|
||||
|
|
|
@ -36,16 +36,18 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
lineEditFormula = ui->lineEditFormula;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
|
@ -61,7 +63,34 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
|
|||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal);
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
|
||||
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNormal::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNormal::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGNORMAL_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGNORMAL_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down"));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -107,14 +136,27 @@ void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
|||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
*/
|
||||
void DialogNormal::DialogAccepted()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNormal::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNormal::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->lineEditFormula->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
angle = ui->doubleSpinBoxAngle->value();
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -158,7 +200,12 @@ void DialogNormal::setAngle(const qreal &value)
|
|||
void DialogNormal::setFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
ui->lineEditFormula->setText(formula);
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGNORMAL_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogNormal;
|
||||
|
@ -66,6 +67,18 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogNormal)
|
||||
|
||||
|
@ -92,6 +105,14 @@ private:
|
|||
|
||||
/** @brief secondPointId id second point of line */
|
||||
quint32 secondPointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -74,17 +74,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula for calculation of length of normal</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -150,6 +150,56 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_formula">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down.png">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
@ -601,14 +651,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditFormula</tabstop>
|
||||
<tabstop>lineEditNamePoint</tabstop>
|
||||
<tabstop>comboBoxFirstPoint</tabstop>
|
||||
<tabstop>comboBoxSecondPoint</tabstop>
|
||||
|
|
|
@ -38,60 +38,93 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0),
|
||||
firstPoint(0), secondPoint(0)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()), radius(QString()),
|
||||
center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(0)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
listWidget = ui.listWidget;
|
||||
labelResultCalculation = ui.labelResultCalculation;
|
||||
labelDescription = ui.labelDescription;
|
||||
radioButtonSizeGrowth = ui.radioButtonSizeGrowth;
|
||||
radioButtonStandardTable = ui.radioButtonStandardTable;
|
||||
radioButtonIncrements = ui.radioButtonIncrements;
|
||||
radioButtonLengthLine = ui.radioButtonLengthLine;
|
||||
radioButtonLengthArc = ui.radioButtonLengthArc;
|
||||
radioButtonLengthCurve = ui.radioButtonLengthSpline;
|
||||
lineEditFormula = ui.lineEditFormula;
|
||||
labelEditFormula = ui.labelEditFormula;
|
||||
labelEditNamePoint = ui.labelEditNamePoint;
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
listWidget = ui->listWidget;
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
labelDescription = ui->labelDescription;
|
||||
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
|
||||
radioButtonStandardTable = ui->radioButtonStandardTable;
|
||||
radioButtonIncrements = ui->radioButtonIncrements;
|
||||
radioButtonLengthLine = ui->radioButtonLengthLine;
|
||||
radioButtonLengthArc = ui->radioButtonLengthArc;
|
||||
radioButtonLengthCurve = ui->radioButtonLengthSpline;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
/* bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
||||
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
SCASSERT(bCansel != nullptr);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
|
||||
*/
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
||||
FillComboBoxPoints(ui.comboBoxCenter);
|
||||
FillComboBoxPoints(ui.comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui.comboBoxSecondPoint);
|
||||
FillComboBoxPoints(ui->comboBoxCenter);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
|
||||
connect(ui.toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere);
|
||||
connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
|
||||
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged);
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
|
||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
{
|
||||
SizeHeight();
|
||||
connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight);
|
||||
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
radioButtonSizeGrowth->setVisible(false);
|
||||
Measurements();
|
||||
}
|
||||
connect(ui.radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::Measurements);
|
||||
connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments);
|
||||
connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines);
|
||||
connect(ui.radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs);
|
||||
connect(ui.radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves);
|
||||
connect(ui.toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula);
|
||||
connect(ui.lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged);
|
||||
connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged);
|
||||
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::Measurements);
|
||||
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments);
|
||||
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines);
|
||||
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs);
|
||||
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves);
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfContact::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfContact::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -107,10 +140,10 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty
|
|||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
{
|
||||
qint32 index = ui.comboBoxFirstPoint->findText(point->name());
|
||||
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui.comboBoxFirstPoint->setCurrentIndex(index);
|
||||
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
||||
number++;
|
||||
emit ToolTip(tr("Select second point of line"));
|
||||
return;
|
||||
|
@ -118,10 +151,10 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty
|
|||
}
|
||||
if (number == 1)
|
||||
{
|
||||
qint32 index = ui.comboBoxSecondPoint->findText(point->name());
|
||||
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui.comboBoxSecondPoint->setCurrentIndex(index);
|
||||
ui->comboBoxSecondPoint->setCurrentIndex(index);
|
||||
number++;
|
||||
emit ToolTip(tr("Select point of center of arc"));
|
||||
return;
|
||||
|
@ -129,10 +162,10 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty
|
|||
}
|
||||
if (number == 2)
|
||||
{
|
||||
qint32 index = ui.comboBoxCenter->findText(point->name());
|
||||
qint32 index = ui->comboBoxCenter->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui.comboBoxCenter->setCurrentIndex(index);
|
||||
ui->comboBoxCenter->setCurrentIndex(index);
|
||||
number = 0;
|
||||
emit ToolTip("");
|
||||
}
|
||||
|
@ -150,14 +183,27 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty
|
|||
*/
|
||||
void DialogPointOfContact::DialogAccepted()
|
||||
{
|
||||
pointName = ui.lineEditNamePoint->text();
|
||||
radius = ui.lineEditFormula->text();
|
||||
center = getCurrentObjectId(ui.comboBoxCenter);
|
||||
firstPoint = getCurrentObjectId(ui.comboBoxFirstPoint);
|
||||
secondPoint = getCurrentObjectId(ui.comboBoxSecondPoint);
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfContact::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfContact::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
radius = ui->plainTextEditFormula->toPlainText();
|
||||
radius.replace("\n"," ");
|
||||
center = getCurrentObjectId(ui->comboBoxCenter);
|
||||
firstPoint = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPoint = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPoint set id second point
|
||||
|
@ -166,7 +212,7 @@ void DialogPointOfContact::DialogAccepted()
|
|||
*/
|
||||
void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id)
|
||||
{
|
||||
setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, secondPoint, value, id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -177,7 +223,7 @@ void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &i
|
|||
*/
|
||||
void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id)
|
||||
{
|
||||
setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, firstPoint, value, id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -188,7 +234,7 @@ void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id
|
|||
*/
|
||||
void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id)
|
||||
{
|
||||
setCurrentPointId(ui.comboBoxCenter, center, value, id);
|
||||
setCurrentPointId(ui->comboBoxCenter, center, value, id);
|
||||
center = value;
|
||||
}
|
||||
|
||||
|
@ -200,7 +246,12 @@ void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id)
|
|||
void DialogPointOfContact::setRadius(const QString &value)
|
||||
{
|
||||
radius = value;
|
||||
ui.lineEditFormula->setText(radius);
|
||||
// increase height if needed.
|
||||
if (radius.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(radius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -211,5 +262,5 @@ void DialogPointOfContact::setRadius(const QString &value)
|
|||
void DialogPointOfContact::setPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui.lineEditNamePoint->setText(pointName);
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
#include "ui_dialogpointofcontact.h"
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPointOfContact;
|
||||
}
|
||||
/**
|
||||
* @brief The DialogPointOfContact class dialog for ToolPointOfContact. Help create point and edit option.
|
||||
*/
|
||||
|
@ -58,11 +63,23 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPointOfContact)
|
||||
|
||||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogPointOfContact ui;
|
||||
Ui::DialogPointOfContact *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
@ -81,6 +98,14 @@ private:
|
|||
|
||||
/** @brief secondPoint id second point of line */
|
||||
quint32 secondPoint;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -74,17 +74,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula for calculation of radius of arc</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -150,6 +150,56 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_formula">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down.png">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
|
@ -441,14 +491,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditFormula</tabstop>
|
||||
<tabstop>lineEditNamePoint</tabstop>
|
||||
<tabstop>comboBoxCenter</tabstop>
|
||||
<tabstop>comboBoxFirstPoint</tabstop>
|
||||
|
|
|
@ -44,7 +44,7 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
|
|||
{
|
||||
ui->setupUi(this);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
||||
|
|
|
@ -57,6 +57,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPointOfIntersection)
|
||||
|
||||
|
|
|
@ -40,16 +40,18 @@
|
|||
*/
|
||||
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0)
|
||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
number = 0;
|
||||
InitVariables(ui);
|
||||
labelResultCalculation = ui->labelResultCalculation;
|
||||
lineEditFormula = ui->lineEditFormula;
|
||||
plainTextEditFormula = ui->plainTextEditFormula;
|
||||
labelEditFormula = ui->labelEditFormula;
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
this->formulaBaseHeight=ui->plainTextEditFormula->height();
|
||||
|
||||
flagFormula = false;
|
||||
flagName = false;
|
||||
|
@ -64,7 +66,36 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
|
|||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal);
|
||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
|
||||
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged);
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged);
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit);
|
||||
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogShoulderPoint::FormulaTextChanged()
|
||||
{
|
||||
this->FormulaChangedPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogShoulderPoint::DeployFormulaTextEdit()
|
||||
{
|
||||
if (ui->plainTextEditFormula->height() < DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -128,14 +159,27 @@ void DialogShoulderPoint::ChoosedObject(quint32 id, const Valentina::Scenes &typ
|
|||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
*/
|
||||
void DialogShoulderPoint::DialogAccepted()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogShoulderPoint::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
emit DialogApplied();
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogShoulderPoint::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->lineEditFormula->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
||||
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
||||
pShoulder = getCurrentObjectId(ui->comboBoxPShoulder);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -179,7 +223,12 @@ void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id)
|
|||
void DialogShoulderPoint::setFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
ui->lineEditFormula->setText(formula);
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
|
||||
#define DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT 64
|
||||
namespace Ui
|
||||
{
|
||||
class DialogShoulderPoint;
|
||||
|
@ -66,6 +67,18 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
void DeployFormulaTextEdit();
|
||||
/**
|
||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||
*/
|
||||
void FormulaTextChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogShoulderPoint)
|
||||
|
||||
|
@ -92,6 +105,14 @@ private:
|
|||
|
||||
/** @brief pShoulder id shoulder point */
|
||||
quint32 pShoulder;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -74,17 +74,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFormula">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula for calculation of length of line</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonPutHere">
|
||||
|
@ -150,6 +150,56 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_formula">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditFormula">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down.png">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
|
@ -462,14 +512,13 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditFormula</tabstop>
|
||||
<tabstop>lineEditNamePoint</tabstop>
|
||||
<tabstop>comboBoxP1Line</tabstop>
|
||||
<tabstop>comboBoxP2Line</tabstop>
|
||||
|
|
|
@ -43,7 +43,7 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
|
|||
ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize));
|
||||
ui->doubleSpinBoxY->setRange(0, qApp->fromPixel(SceneSize));
|
||||
labelEditNamePoint = ui->labelEditName;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
|
|
@ -51,6 +51,10 @@ public:
|
|||
public slots:
|
||||
void mousePress(const QPointF &scenePos);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSinglePoint)
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
|
|||
kAsm1(1), kAsm2(1), kCurve(1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxP1);
|
||||
FillComboBoxPoints(ui->comboBoxP4);
|
||||
|
|
|
@ -69,6 +69,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSpline)
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
|
|||
:DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
bOk->setEnabled(false);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
|
@ -159,7 +159,7 @@ void DialogSplinePath::Angle1Changed(qreal index)
|
|||
{
|
||||
qint32 row = ui->listWidget->currentRow();
|
||||
QListWidgetItem *item = ui->listWidget->item( row );
|
||||
Q_CHECK_PTR(item);
|
||||
SCASSERT(item != nullptr);
|
||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||
p.SetAngle1(index);
|
||||
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
||||
|
@ -175,7 +175,7 @@ void DialogSplinePath::Angle2Changed(qreal index)
|
|||
{
|
||||
qint32 row = ui->listWidget->currentRow();
|
||||
QListWidgetItem *item = ui->listWidget->item( row );
|
||||
Q_CHECK_PTR(item);
|
||||
SCASSERT(item != nullptr);
|
||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||
p.SetAngle2(index);
|
||||
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
||||
|
|
|
@ -52,6 +52,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
void PointChanged(int row);
|
||||
void currentPointChanged( int index );
|
||||
void Angle1Changed(qreal index );
|
||||
|
|
|
@ -43,13 +43,13 @@
|
|||
*/
|
||||
DialogTool::DialogTool(const VContainer *data, QWidget *parent)
|
||||
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(nullptr),
|
||||
bOk(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), listWidget(nullptr),
|
||||
labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
|
||||
bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), plainTextEditFormula(nullptr),
|
||||
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
|
||||
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
|
||||
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
||||
radioButtonLengthCurve(nullptr), lineStyles(QStringList())
|
||||
radioButtonLengthCurve(nullptr), lineStyles(QStringList()), associatedTool(nullptr)
|
||||
{
|
||||
Q_CHECK_PTR(data);
|
||||
SCASSERT(data != nullptr);
|
||||
timerFormula = new QTimer(this);
|
||||
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
|
||||
//Keep synchronize with VAbstractTool styles list!!!
|
||||
|
@ -97,7 +97,7 @@ void DialogTool::showEvent(QShowEvent *event)
|
|||
*/
|
||||
void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject*> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject*> i(*objs);
|
||||
QMap<QString, quint32> list;
|
||||
|
@ -120,7 +120,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject*> i(*objs);
|
||||
QMap<QString, quint32> list;
|
||||
|
@ -164,7 +164,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::
|
|||
*/
|
||||
void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject*> i(*objs);
|
||||
QMap<QString, quint32> list;
|
||||
|
@ -208,7 +208,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod
|
|||
*/
|
||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject *> i(*objs);
|
||||
QMap<QString, quint32> list;
|
||||
|
@ -250,7 +250,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb
|
|||
*/
|
||||
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
box->addItems(lineStyles);
|
||||
box->setCurrentIndex(1);
|
||||
}
|
||||
|
@ -347,16 +347,36 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const
|
|||
*/
|
||||
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
||||
{
|
||||
Q_CHECK_PTR(lineEdit);
|
||||
Q_CHECK_PTR(listWidget);
|
||||
SCASSERT(lineEdit != nullptr);
|
||||
SCASSERT(listWidget != nullptr);
|
||||
QListWidgetItem *item = listWidget->currentItem();
|
||||
Q_CHECK_PTR(item);
|
||||
SCASSERT(item != nullptr);
|
||||
|
||||
int pos = lineEdit->cursorPosition();
|
||||
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
||||
lineEdit->setFocus();
|
||||
lineEdit->setCursorPosition(pos + item->text().size());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget)
|
||||
{
|
||||
SCASSERT(plainTextEdit != nullptr);
|
||||
SCASSERT(listWidget != nullptr);
|
||||
QListWidgetItem *item = listWidget->currentItem();
|
||||
SCASSERT(item != nullptr);
|
||||
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
cursor.insertText(item->text());
|
||||
plainTextEdit->setTextCursor(cursor);
|
||||
/*
|
||||
int pos = lineEdit->cursorPosition();
|
||||
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
||||
lineEdit->setFocus();
|
||||
lineEdit->setCursorPosition(pos + item->text().size());
|
||||
*/
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ValFormulaChanged handle change formula
|
||||
|
@ -366,9 +386,9 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
|||
*/
|
||||
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
|
||||
{
|
||||
Q_CHECK_PTR(edit);
|
||||
Q_CHECK_PTR(timer);
|
||||
Q_CHECK_PTR(labelEditFormula);
|
||||
SCASSERT(edit != nullptr);
|
||||
SCASSERT(timer != nullptr);
|
||||
SCASSERT(labelEditFormula != nullptr);
|
||||
if (edit->text().isEmpty())
|
||||
{
|
||||
flag = false;
|
||||
|
@ -380,6 +400,23 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
|
|||
}
|
||||
timer->start(1000);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *timer)
|
||||
{
|
||||
SCASSERT(edit != nullptr);
|
||||
SCASSERT(timer != nullptr);
|
||||
SCASSERT(labelEditFormula != nullptr);
|
||||
if (edit->toPlainText().isEmpty())
|
||||
{
|
||||
flag = false;
|
||||
CheckState();
|
||||
QPalette palette = labelEditFormula->palette();
|
||||
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
|
||||
labelEditFormula->setPalette(palette);
|
||||
return;
|
||||
}
|
||||
timer->start(1000);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -391,10 +428,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
|
|||
*/
|
||||
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
||||
{
|
||||
Q_CHECK_PTR(edit);
|
||||
Q_CHECK_PTR(timer);
|
||||
Q_CHECK_PTR(label);
|
||||
Q_CHECK_PTR(labelEditFormula);
|
||||
SCASSERT(edit != nullptr);
|
||||
SCASSERT(timer != nullptr);
|
||||
SCASSERT(label != nullptr);
|
||||
SCASSERT(labelEditFormula != nullptr);
|
||||
QPalette palette = labelEditFormula->palette();
|
||||
if (edit->text().isEmpty())
|
||||
{
|
||||
|
@ -447,16 +484,70 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setCurrentPointId set current point id in combobox
|
||||
* @param box combobox
|
||||
* @param pointId save current point id
|
||||
* @param value point id
|
||||
* @param id don't show this id in list
|
||||
*/
|
||||
void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
||||
{
|
||||
SCASSERT(edit != nullptr);
|
||||
SCASSERT(timer != nullptr);
|
||||
SCASSERT(label != nullptr);
|
||||
SCASSERT(labelEditFormula != nullptr);
|
||||
QPalette palette = labelEditFormula->palette();
|
||||
if (edit->toPlainText().isEmpty())
|
||||
{
|
||||
flag = false;
|
||||
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Replace line return with spaces for calc
|
||||
QString formula = edit->toPlainText();
|
||||
formula.replace("\n"," ");
|
||||
formula = qApp->FormulaFromUser(formula);
|
||||
Calculator *cal = new Calculator(data);
|
||||
const qreal result = cal->EvalFormula(formula);
|
||||
delete cal;
|
||||
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
|
||||
|
||||
if (osSeparatorValue)
|
||||
{
|
||||
QLocale loc = QLocale::system();
|
||||
label->setText(loc.toString(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
QLocale loc = QLocale(QLocale::C);
|
||||
label->setText(loc.toString(result));
|
||||
}
|
||||
flag = true;
|
||||
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
||||
emit ToolTip("");
|
||||
}
|
||||
catch(qmu::QmuParserError &e)
|
||||
{
|
||||
label->setText(tr("Error"));
|
||||
flag = false;
|
||||
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
|
||||
emit ToolTip("Parser error: "+e.GetMsg());
|
||||
qDebug() << "\nMath parser error:\n"
|
||||
<< "--------------------------------------\n"
|
||||
<< "Message: " << e.GetMsg() << "\n"
|
||||
<< "Expression: " << e.GetExpr() << "\n"
|
||||
<< "--------------------------------------";
|
||||
}
|
||||
}
|
||||
CheckState();
|
||||
timer->stop();
|
||||
labelEditFormula->setPalette(palette);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxPoints(box, id);
|
||||
pointId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
|
@ -474,7 +565,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint
|
|||
void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
|
||||
ComboMode::ComboBoxCutSpline cut) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplines(box, id, cut);
|
||||
splineId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
|
@ -492,7 +583,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
|
|||
void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id,
|
||||
ComboMode::ComboBoxCutArc cut) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxArcs(box, id, cut);
|
||||
arcId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
|
@ -510,7 +601,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &
|
|||
void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
|
||||
const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplinesPath(box, id, cut);
|
||||
splinePathId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
|
@ -524,7 +615,7 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, c
|
|||
*/
|
||||
quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
qint32 index = box->currentIndex();
|
||||
Q_ASSERT(index != -1);
|
||||
if (index != -1)
|
||||
|
@ -540,9 +631,9 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip)
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
Q_CHECK_PTR(point);
|
||||
SCASSERT(point != nullptr);
|
||||
const qint32 index = box->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
|
@ -561,7 +652,7 @@ bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &
|
|||
*/
|
||||
void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
|
||||
{
|
||||
Q_CHECK_PTR(box);
|
||||
SCASSERT(box != nullptr);
|
||||
box->clear();
|
||||
|
||||
QMapIterator<QString, quint32> iter(list);
|
||||
|
@ -578,8 +669,13 @@ void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) co
|
|||
*/
|
||||
void DialogTool::CheckState()
|
||||
{
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagFormula && flagName);
|
||||
// In case dialog hasn't apply button
|
||||
if ( bApply != nullptr)
|
||||
{
|
||||
bApply->setEnabled(flagFormula && flagName);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -600,7 +696,7 @@ void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
|||
*/
|
||||
void DialogTool::NamePointChanged()
|
||||
{
|
||||
Q_CHECK_PTR(labelEditNamePoint);
|
||||
SCASSERT(labelEditNamePoint != nullptr);
|
||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
||||
if (edit)
|
||||
{
|
||||
|
@ -653,6 +749,15 @@ void DialogTool::FormulaChanged()
|
|||
ValFormulaChanged(flagFormula, edit, timerFormula);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::FormulaChangedPlainText()
|
||||
{
|
||||
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
|
||||
if (edit)
|
||||
{
|
||||
ValFormulaChanged(flagFormula, edit, timerFormula);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -660,7 +765,7 @@ void DialogTool::FormulaChanged()
|
|||
*/
|
||||
void DialogTool::ArrowUp()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(90);
|
||||
}
|
||||
|
||||
|
@ -670,7 +775,7 @@ void DialogTool::ArrowUp()
|
|||
*/
|
||||
void DialogTool::ArrowDown()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(270);
|
||||
}
|
||||
|
||||
|
@ -680,7 +785,7 @@ void DialogTool::ArrowDown()
|
|||
*/
|
||||
void DialogTool::ArrowLeft()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(180);
|
||||
}
|
||||
|
||||
|
@ -690,7 +795,7 @@ void DialogTool::ArrowLeft()
|
|||
*/
|
||||
void DialogTool::ArrowRight()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(0);
|
||||
}
|
||||
|
||||
|
@ -700,7 +805,7 @@ void DialogTool::ArrowRight()
|
|||
*/
|
||||
void DialogTool::ArrowLeftUp()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(135);
|
||||
}
|
||||
|
||||
|
@ -710,7 +815,7 @@ void DialogTool::ArrowLeftUp()
|
|||
*/
|
||||
void DialogTool::ArrowLeftDown()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(225);
|
||||
}
|
||||
|
||||
|
@ -720,7 +825,7 @@ void DialogTool::ArrowLeftDown()
|
|||
*/
|
||||
void DialogTool::ArrowRightUp()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(45);
|
||||
}
|
||||
|
||||
|
@ -730,7 +835,7 @@ void DialogTool::ArrowRightUp()
|
|||
*/
|
||||
void DialogTool::ArrowRightDown()
|
||||
{
|
||||
Q_CHECK_PTR(spinBoxAngle);
|
||||
SCASSERT(spinBoxAngle != nullptr);
|
||||
spinBoxAngle->setValue(315);
|
||||
}
|
||||
|
||||
|
@ -740,9 +845,9 @@ void DialogTool::ArrowRightDown()
|
|||
*/
|
||||
void DialogTool::EvalFormula()
|
||||
{
|
||||
Q_CHECK_PTR(lineEditFormula);
|
||||
Q_CHECK_PTR(labelResultCalculation);
|
||||
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
|
||||
SCASSERT(plainTextEditFormula != nullptr);
|
||||
SCASSERT(labelResultCalculation != nullptr);
|
||||
Eval(plainTextEditFormula, flagFormula, timerFormula, labelResultCalculation);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -751,7 +856,7 @@ void DialogTool::EvalFormula()
|
|||
*/
|
||||
void DialogTool::SizeHeight()
|
||||
{
|
||||
Q_CHECK_PTR(listWidget);
|
||||
SCASSERT(listWidget != nullptr);
|
||||
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||
listWidget->clear();
|
||||
|
||||
|
@ -820,7 +925,7 @@ void DialogTool::Increments()
|
|||
*/
|
||||
void DialogTool::PutHere()
|
||||
{
|
||||
PutValHere(lineEditFormula, listWidget);
|
||||
PutValHere(plainTextEditFormula, listWidget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -830,13 +935,17 @@ void DialogTool::PutHere()
|
|||
*/
|
||||
void DialogTool::PutVal(QListWidgetItem *item)
|
||||
{
|
||||
Q_CHECK_PTR(lineEditFormula);
|
||||
Q_CHECK_PTR(item);
|
||||
int pos = lineEditFormula->cursorPosition();
|
||||
SCASSERT(plainTextEditFormula != nullptr);
|
||||
SCASSERT(item != nullptr);
|
||||
QTextCursor cursor = plainTextEditFormula->textCursor();
|
||||
cursor.insertText(item->text());
|
||||
plainTextEditFormula->setTextCursor(cursor);
|
||||
/*int pos = plainTextEditFormula->cursorPosition();
|
||||
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
|
||||
item->text()));
|
||||
lineEditFormula->setFocus();
|
||||
lineEditFormula->setCursorPosition(pos + item->text().size());
|
||||
*/
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -846,14 +955,14 @@ void DialogTool::PutVal(QListWidgetItem *item)
|
|||
*/
|
||||
void DialogTool::ValChenged(int row)
|
||||
{
|
||||
Q_CHECK_PTR(listWidget);
|
||||
Q_CHECK_PTR(labelDescription);
|
||||
Q_CHECK_PTR(radioButtonSizeGrowth);
|
||||
Q_CHECK_PTR(radioButtonStandardTable);
|
||||
Q_CHECK_PTR(radioButtonIncrements);
|
||||
Q_CHECK_PTR(radioButtonLengthLine);
|
||||
Q_CHECK_PTR(radioButtonLengthArc);
|
||||
Q_CHECK_PTR(radioButtonLengthCurve);
|
||||
SCASSERT(listWidget != nullptr);
|
||||
SCASSERT(labelDescription != nullptr);
|
||||
SCASSERT(radioButtonSizeGrowth != nullptr);
|
||||
SCASSERT(radioButtonStandardTable != nullptr);
|
||||
SCASSERT(radioButtonIncrements != nullptr);
|
||||
SCASSERT(radioButtonLengthLine != nullptr);
|
||||
SCASSERT(radioButtonLengthArc != nullptr);
|
||||
SCASSERT(radioButtonLengthCurve != nullptr);
|
||||
if (listWidget->count() == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -919,12 +1028,12 @@ void DialogTool::ValChenged(int row)
|
|||
*/
|
||||
void DialogTool::UpdateList()
|
||||
{
|
||||
Q_CHECK_PTR(radioButtonSizeGrowth);
|
||||
Q_CHECK_PTR(radioButtonStandardTable);
|
||||
Q_CHECK_PTR(radioButtonIncrements);
|
||||
Q_CHECK_PTR(radioButtonLengthLine);
|
||||
Q_CHECK_PTR(radioButtonLengthArc);
|
||||
Q_CHECK_PTR(radioButtonLengthCurve);
|
||||
SCASSERT(radioButtonSizeGrowth != nullptr);
|
||||
SCASSERT(radioButtonStandardTable != nullptr);
|
||||
SCASSERT(radioButtonIncrements != nullptr);
|
||||
SCASSERT(radioButtonLengthLine != nullptr);
|
||||
SCASSERT(radioButtonLengthArc != nullptr);
|
||||
SCASSERT(radioButtonLengthCurve != nullptr);
|
||||
|
||||
if (radioButtonSizeGrowth->isChecked())
|
||||
{
|
||||
|
@ -960,7 +1069,7 @@ void DialogTool::UpdateList()
|
|||
template <class key, class val>
|
||||
void DialogTool::ShowVariable(const QHash<key, val> *var)
|
||||
{
|
||||
Q_CHECK_PTR(listWidget);
|
||||
SCASSERT(listWidget != nullptr);
|
||||
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||
listWidget->clear();
|
||||
|
||||
|
@ -983,3 +1092,9 @@ void DialogTool::ShowVariable(const QHash<key, val> *var)
|
|||
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||
listWidget->setCurrentRow (0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::DialogApply()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ class QListWidgetItem;
|
|||
class QLineEdit;
|
||||
class QListWidget;
|
||||
class VContainer;
|
||||
class QPlainTextEdit;
|
||||
class VAbstractTool;
|
||||
|
||||
namespace ComboMode
|
||||
{
|
||||
|
@ -65,12 +67,18 @@ class DialogTool : public QDialog
|
|||
public:
|
||||
DialogTool(const VContainer *data, QWidget *parent = nullptr);
|
||||
virtual ~DialogTool() {}
|
||||
VAbstractTool* GetAssociatedTool();
|
||||
void SetAssociatedTool(VAbstractTool* tool);
|
||||
signals:
|
||||
/**
|
||||
* @brief DialogClosed signal dialog closed
|
||||
* @param result keep result
|
||||
*/
|
||||
void DialogClosed(int result);
|
||||
/**
|
||||
* @brief DialogApplied emit signal dialog apply changes
|
||||
*/
|
||||
void DialogApplied();
|
||||
/**
|
||||
* @brief ToolTip emit tooltipe for tool
|
||||
* @param toolTip text tooltipe
|
||||
|
@ -80,8 +88,16 @@ public slots:
|
|||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
void NamePointChanged();
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply save data and emit signal DialogApplied.
|
||||
*/
|
||||
virtual void DialogApply();
|
||||
virtual void DialogRejected();
|
||||
void FormulaChanged();
|
||||
/**
|
||||
* @brief FormulaChangedPlainText check formula (plain text editor editor)
|
||||
*/
|
||||
void FormulaChangedPlainText();
|
||||
void ArrowUp();
|
||||
void ArrowDown();
|
||||
void ArrowLeft();
|
||||
|
@ -122,12 +138,15 @@ protected:
|
|||
/** @brief bOk button ok */
|
||||
QPushButton *bOk;
|
||||
|
||||
/** @brief bApply button apply */
|
||||
QPushButton *bApply;
|
||||
|
||||
/** @brief spinBoxAngle spinbox for angle */
|
||||
QDoubleSpinBox *spinBoxAngle;
|
||||
|
||||
/** @brief lineEditFormula linEdit for formula */
|
||||
QLineEdit *lineEditFormula;
|
||||
|
||||
QPlainTextEdit *plainTextEditFormula;
|
||||
/** @brief listWidget listWidget with variables */
|
||||
QListWidget *listWidget;
|
||||
|
||||
|
@ -182,7 +201,10 @@ protected:
|
|||
void ChangeCurrentText(QComboBox *box, const QString &value);
|
||||
void ChangeCurrentData(QComboBox *box, const quint32 &value) const;
|
||||
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
|
||||
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
||||
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
||||
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
||||
void Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *label);
|
||||
void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label);
|
||||
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const;
|
||||
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
|
||||
|
@ -197,7 +219,7 @@ protected:
|
|||
template <typename T>
|
||||
void InitArrow(T *ui)
|
||||
{
|
||||
Q_CHECK_PTR(ui);
|
||||
SCASSERT(ui != nullptr);
|
||||
spinBoxAngle = ui->doubleSpinBoxAngle;
|
||||
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown);
|
||||
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp);
|
||||
|
@ -240,18 +262,50 @@ protected:
|
|||
connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves);
|
||||
}
|
||||
template <typename T>
|
||||
void InitOkCansel(T *ui)
|
||||
/**
|
||||
* @brief InitOkCancelApply initialise OK / Cancel and Apply buttons
|
||||
* @param ui Dialog container
|
||||
*/
|
||||
void InitOkCancelApply(T *ui)
|
||||
{
|
||||
InitOkCancel(ui);
|
||||
bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
|
||||
SCASSERT(bApply != nullptr);
|
||||
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
|
||||
}
|
||||
template <typename T>
|
||||
/**
|
||||
* @brief InitOkCancel initialise OK and Cancel buttons
|
||||
* @param ui Dialog container
|
||||
*/
|
||||
void InitOkCancel(T *ui)
|
||||
{
|
||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
SCASSERT(bOk != nullptr);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
||||
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
SCASSERT(bCancel != nullptr);
|
||||
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
}
|
||||
/**
|
||||
* @brief associatedTool vdrawtool associated with opened dialog.
|
||||
*/
|
||||
VAbstractTool* associatedTool;
|
||||
private:
|
||||
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline VAbstractTool *DialogTool::GetAssociatedTool()
|
||||
{
|
||||
return this->associatedTool;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void DialogTool::SetAssociatedTool(VAbstractTool *tool)
|
||||
{
|
||||
this->associatedTool=tool;
|
||||
}
|
||||
|
||||
#endif // DIALOGTOOL_H
|
||||
|
|
|
@ -43,7 +43,7 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
flagName = false;
|
||||
CheckState();
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogTriangle)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent)
|
|||
numberP(0), p1(0), p2(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCansel(ui);
|
||||
InitOkCancel(ui);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -53,6 +53,10 @@ public:
|
|||
public slots:
|
||||
void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogUnionDetails)
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const
|
||||
{
|
||||
Q_CHECK_PTR(data);
|
||||
SCASSERT(data != nullptr);
|
||||
VDetail detail = data->GetDetail(idDetail);
|
||||
QVector<QPointF> points;
|
||||
QVector<QPointF> pointsEkv;
|
||||
|
|
|
@ -185,7 +185,7 @@ void MainWindow::ActionNewPP()
|
|||
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||
Q_CHECK_PTR(tools);
|
||||
SCASSERT(tools != nullptr);
|
||||
tools->insert(id, spoint);
|
||||
VDrawTool::AddRecord(id, Valentina::SinglePointTool, doc);
|
||||
SetEnableTool(true);
|
||||
|
@ -254,12 +254,50 @@ void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &
|
|||
{
|
||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||
{
|
||||
Q_CHECK_PTR(tButton);
|
||||
SCASSERT(tButton != nullptr);
|
||||
tButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename Dialog, typename Func, typename Func2>
|
||||
/**
|
||||
* @brief SetToolButtonWithApply set tool and show dialog.
|
||||
* @param checked true if tool button checked.
|
||||
* @param t tool type.
|
||||
* @param cursor path tool cursor icon.
|
||||
* @param toolTip first tooltipe.
|
||||
* @param closeDialogSlot function to handle close of dialog.
|
||||
* @param applyDialogSlot function to handle apply in dialog.
|
||||
*/
|
||||
void MainWindow::SetToolButtonWithApply(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot, Func2 applyDialogSlot)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
CancelTool();
|
||||
tool = t;
|
||||
QPixmap pixmap(cursor);
|
||||
QCursor cur(pixmap, 2, 3);
|
||||
view->setCursor(cur);
|
||||
helpLabel->setText(toolTip);
|
||||
dialogTool = new Dialog(pattern, this);
|
||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject);
|
||||
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
||||
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);
|
||||
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
||||
connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||
{
|
||||
SCASSERT(tButton != nullptr);
|
||||
tButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ClosedDialog handle close dialog
|
||||
|
@ -268,7 +306,7 @@ void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &
|
|||
template <typename DrawTool>
|
||||
void MainWindow::ClosedDialog(int result)
|
||||
{
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
if (result == QDialog::Accepted)
|
||||
{
|
||||
DrawTool::Create(dialogTool, currentScene, doc, pattern);
|
||||
|
@ -276,6 +314,59 @@ void MainWindow::ClosedDialog(int result)
|
|||
ArrowTool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ClosedDialogWithApply handle close dialog that has apply button
|
||||
* @param result result working dialog.
|
||||
*/
|
||||
template <typename DrawTool>
|
||||
void MainWindow::ClosedDialogWithApply(int result)
|
||||
{
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
if (result == QDialog::Accepted)
|
||||
{
|
||||
// Only create tool if not already created with apply
|
||||
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||
{
|
||||
dialogTool->SetAssociatedTool(
|
||||
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
||||
}
|
||||
else
|
||||
{ // Or update associated tool with data
|
||||
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
|
||||
vtool->FullUpdateFromGuiApply();
|
||||
}
|
||||
}
|
||||
if (dialogTool->GetAssociatedTool() != nullptr)
|
||||
{
|
||||
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
|
||||
vtool->DialogLinkDestroy();
|
||||
}
|
||||
ArrowTool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialog handle apply in dialog
|
||||
*/
|
||||
template <typename DrawTool>
|
||||
void MainWindow::ApplyDialog()
|
||||
{
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
|
||||
// Only create tool if not already created with apply
|
||||
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||
{
|
||||
dialogTool->SetAssociatedTool(
|
||||
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
||||
}
|
||||
else
|
||||
{ // Or update associated tool with data
|
||||
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
|
||||
vtool->FullUpdateFromGuiApply();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ToolEndLine handler tool endLine.
|
||||
|
@ -283,8 +374,17 @@ void MainWindow::ClosedDialog(int result)
|
|||
*/
|
||||
void MainWindow::ToolEndLine(bool checked)
|
||||
{
|
||||
SetToolButton<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
||||
&MainWindow::ClosedDialogEndLine);
|
||||
SetToolButtonWithApply<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
||||
&MainWindow::ClosedDialogEndLine,&MainWindow::ApplyDialogEndLine);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogEndLine actions after apply in DialogEndLine.
|
||||
*/
|
||||
void MainWindow::ApplyDialogEndLine()
|
||||
{
|
||||
ApplyDialog<VToolEndLine>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -294,7 +394,7 @@ void MainWindow::ToolEndLine(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogEndLine(int result)
|
||||
{
|
||||
ClosedDialog<VToolEndLine>(result);
|
||||
ClosedDialogWithApply<VToolEndLine>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -325,8 +425,17 @@ void MainWindow::ClosedDialogLine(int result)
|
|||
*/
|
||||
void MainWindow::ToolAlongLine(bool checked)
|
||||
{
|
||||
SetToolButton<DialogAlongLine>(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png",
|
||||
tr("Select point"), &MainWindow::ClosedDialogAlongLine);
|
||||
SetToolButtonWithApply<DialogAlongLine>(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png",
|
||||
tr("Select point"), &MainWindow::ClosedDialogAlongLine, &MainWindow::ApplyDialogAlongLine);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogAlongLine actions after apply in DialogAlongLine.
|
||||
*/
|
||||
void MainWindow::ApplyDialogAlongLine()
|
||||
{
|
||||
ApplyDialog<VToolAlongLine>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -336,7 +445,7 @@ void MainWindow::ToolAlongLine(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogAlongLine(int result)
|
||||
{
|
||||
ClosedDialog<VToolAlongLine>(result);
|
||||
ClosedDialogWithApply<VToolAlongLine>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -346,8 +455,18 @@ void MainWindow::ClosedDialogAlongLine(int result)
|
|||
*/
|
||||
void MainWindow::ToolShoulderPoint(bool checked)
|
||||
{
|
||||
SetToolButton<DialogShoulderPoint>(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint);
|
||||
SetToolButtonWithApply<DialogShoulderPoint>(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint,
|
||||
&MainWindow::ApplyDialogShoulderPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogShoulderPoint actions after apply in DialogShoulderPoint.
|
||||
*/
|
||||
void MainWindow::ApplyDialogShoulderPoint()
|
||||
{
|
||||
ApplyDialog<VToolShoulderPoint>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -357,7 +476,7 @@ void MainWindow::ToolShoulderPoint(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogShoulderPoint(int result)
|
||||
{
|
||||
ClosedDialog<VToolShoulderPoint>(result);
|
||||
ClosedDialogWithApply<VToolShoulderPoint>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -367,8 +486,18 @@ void MainWindow::ClosedDialogShoulderPoint(int result)
|
|||
*/
|
||||
void MainWindow::ToolNormal(bool checked)
|
||||
{
|
||||
SetToolButton<DialogNormal>(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogNormal);
|
||||
SetToolButtonWithApply<DialogNormal>(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogNormal,
|
||||
&MainWindow::ApplyDialogNormal);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogNormal actions after apply in DialogNormal.
|
||||
*/
|
||||
void MainWindow::ApplyDialogNormal()
|
||||
{
|
||||
ApplyDialog<VToolNormal>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -378,7 +507,7 @@ void MainWindow::ToolNormal(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogNormal(int result)
|
||||
{
|
||||
ClosedDialog<VToolNormal>(result);
|
||||
ClosedDialogWithApply<VToolNormal>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -388,8 +517,18 @@ void MainWindow::ClosedDialogNormal(int result)
|
|||
*/
|
||||
void MainWindow::ToolBisector(bool checked)
|
||||
{
|
||||
SetToolButton<DialogBisector>(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png",
|
||||
tr("Select first point of angle"), &MainWindow::ClosedDialogBisector);
|
||||
SetToolButtonWithApply<DialogBisector>(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png",
|
||||
tr("Select first point of angle"), &MainWindow::ClosedDialogBisector,
|
||||
&MainWindow::ApplyDialogBisector);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogBisector actions after apply in DialogBisector.
|
||||
*/
|
||||
void MainWindow::ApplyDialogBisector()
|
||||
{
|
||||
ApplyDialog<VToolBisector>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -399,7 +538,7 @@ void MainWindow::ToolBisector(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogBisector(int result)
|
||||
{
|
||||
ClosedDialog<VToolBisector>(result);
|
||||
ClosedDialogWithApply<VToolBisector>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -472,8 +611,18 @@ void MainWindow::ClosedDialogCutSpline(int result)
|
|||
*/
|
||||
void MainWindow::ToolArc(bool checked)
|
||||
{
|
||||
SetToolButton<DialogArc>(checked, Valentina::ArcTool, ":/cursor/arc_cursor.png",
|
||||
tr("Select point of center of arc"), &MainWindow::ClosedDialogArc);
|
||||
SetToolButtonWithApply<DialogArc>(checked, Valentina::ArcTool, ":/cursor/arc_cursor.png",
|
||||
tr("Select point of center of arc"), &MainWindow::ClosedDialogArc,
|
||||
&MainWindow::ApplyDialogArc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogArc actions after apply in DialogArc.
|
||||
*/
|
||||
void MainWindow::ApplyDialogArc()
|
||||
{
|
||||
ApplyDialog<VToolArc>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -483,7 +632,7 @@ void MainWindow::ToolArc(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogArc(int result)
|
||||
{
|
||||
ClosedDialog<VToolArc>(result);
|
||||
ClosedDialogWithApply<VToolArc>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -536,8 +685,18 @@ void MainWindow::ClosedDialogCutSplinePath(int result)
|
|||
*/
|
||||
void MainWindow::ToolPointOfContact(bool checked)
|
||||
{
|
||||
SetToolButton<DialogPointOfContact>(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact);
|
||||
SetToolButtonWithApply<DialogPointOfContact>(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact,
|
||||
&MainWindow::ApplyDialogPointOfContact);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogPointOfContact actions after apply in DialogPointOfContact.
|
||||
*/
|
||||
void MainWindow::ApplyDialogPointOfContact()
|
||||
{
|
||||
ApplyDialog<VToolPointOfContact>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -547,7 +706,7 @@ void MainWindow::ToolPointOfContact(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogPointOfContact(int result)
|
||||
{
|
||||
ClosedDialog<VToolPointOfContact>(result);
|
||||
ClosedDialogWithApply<VToolPointOfContact>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -671,8 +830,17 @@ void MainWindow::ClosedDialogUnionDetails(int result)
|
|||
*/
|
||||
void MainWindow::ToolCutArc(bool checked)
|
||||
{
|
||||
SetToolButton<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png", tr("Select arc"),
|
||||
&MainWindow::ClosedDialogCutArc);
|
||||
SetToolButtonWithApply<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png",
|
||||
tr("Select arc"), &MainWindow::ClosedDialogCutArc, &MainWindow::ApplyDialogCutArc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ApplyDialogCutArc actions after apply in DialogCutArc.
|
||||
*/
|
||||
void MainWindow::ApplyDialogCutArc()
|
||||
{
|
||||
ApplyDialog<VToolCutArc>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -682,7 +850,7 @@ void MainWindow::ToolCutArc(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogCutArc(int result)
|
||||
{
|
||||
ClosedDialog<VToolCutArc>(result);
|
||||
ClosedDialogWithApply<VToolCutArc>(result);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -742,6 +910,14 @@ void MainWindow::PatternProperties()
|
|||
proper.exec();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::EditPatternCode()
|
||||
{
|
||||
DialogPatternXmlEdit *Pattern = new DialogPatternXmlEdit (this, doc);
|
||||
Pattern->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
Pattern->show();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief showEvent handle after show window.
|
||||
|
@ -1488,6 +1664,8 @@ void MainWindow::SetEnableWidgets(bool enable)
|
|||
}
|
||||
ui->actionTable->setEnabled(enable);
|
||||
ui->actionHistory->setEnabled(enable);
|
||||
ui->actionPattern_properties->setEnabled(enable);
|
||||
ui->actionEdit_pattern_code->setEnabled(enable);
|
||||
ui->actionZoomIn->setEnabled(enable);
|
||||
ui->actionZoomOut->setEnabled(enable);
|
||||
}
|
||||
|
@ -1851,6 +2029,8 @@ void MainWindow::CreateActions()
|
|||
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences);
|
||||
connect(ui->actionPattern_properties, &QAction::triggered, this, &MainWindow::PatternProperties);
|
||||
ui->actionPattern_properties->setEnabled(false);
|
||||
connect(ui->actionEdit_pattern_code, &QAction::triggered, this, &MainWindow::EditPatternCode);
|
||||
ui->actionEdit_pattern_code->setEnabled(false);
|
||||
|
||||
//Actions for recent files loaded by a main window application.
|
||||
for (int i = 0; i < MaxRecentFiles; ++i)
|
||||
|
|
|
@ -103,17 +103,24 @@ public slots:
|
|||
void ToolCutArc(bool checked);
|
||||
|
||||
void ClosedDialogEndLine(int result);
|
||||
void ApplyDialogEndLine();
|
||||
void ClosedDialogLine(int result);
|
||||
void ClosedDialogAlongLine(int result);
|
||||
void ApplyDialogAlongLine();
|
||||
void ClosedDialogShoulderPoint(int result);
|
||||
void ApplyDialogShoulderPoint();
|
||||
void ClosedDialogNormal(int result);
|
||||
void ApplyDialogNormal();
|
||||
void ClosedDialogBisector(int result);
|
||||
void ApplyDialogBisector();
|
||||
void ClosedDialogLineIntersect(int result);
|
||||
void ClosedDialogSpline(int result);
|
||||
void ClosedDialogArc(int result);
|
||||
void ApplyDialogArc();
|
||||
void ClosedDialogSplinePath(int result);
|
||||
void ClosedDialogCutSplinePath(int result);
|
||||
void ClosedDialogPointOfContact(int result);
|
||||
void ApplyDialogPointOfContact();
|
||||
void ClosedDialogDetail(int result);
|
||||
void ClosedDialogHeight(int result);
|
||||
void ClosedDialogTriangle(int result);
|
||||
|
@ -121,6 +128,7 @@ public slots:
|
|||
void ClosedDialogUnionDetails(int result);
|
||||
void ClosedDialogCutSpline(int result);
|
||||
void ClosedDialogCutArc(int result);
|
||||
void ApplyDialogCutArc();
|
||||
|
||||
void About();
|
||||
void AboutQt();
|
||||
|
@ -129,6 +137,10 @@ public slots:
|
|||
void ShowToolTip(const QString &toolTip);
|
||||
void OpenRecentFile();
|
||||
void Clear();
|
||||
/**
|
||||
* @brief Edit XML code of pattern
|
||||
*/
|
||||
void EditPatternCode();
|
||||
void FullParseFile();
|
||||
signals:
|
||||
/**
|
||||
|
@ -217,10 +229,15 @@ private:
|
|||
template <typename Dialog, typename Func>
|
||||
void SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot);
|
||||
|
||||
template <typename Dialog, typename Func, typename Func2>
|
||||
void SetToolButtonWithApply(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot, Func2 applyDialogSlot);
|
||||
template <typename DrawTool>
|
||||
void ClosedDialog(int result);
|
||||
|
||||
template <typename DrawTool>
|
||||
void ClosedDialogWithApply(int result);
|
||||
template <typename DrawTool>
|
||||
void ApplyDialog();
|
||||
bool SavePattern(const QString &curFile);
|
||||
void AutoSavePattern();
|
||||
void setCurrentFile(const QString &fileName);
|
||||
|
|
|
@ -699,6 +699,7 @@
|
|||
<addaction name="actionZoomOut"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPattern_properties"/>
|
||||
<addaction name="actionEdit_pattern_code"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuMeasurements">
|
||||
<property name="title">
|
||||
|
@ -1055,6 +1056,11 @@
|
|||
<property name="toolTip">
|
||||
<string>Zoom out</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_pattern_code">
|
||||
<property name="text">
|
||||
<string>Edit pattern XML code</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
|
|
@ -340,6 +340,8 @@ extern const QString in_Oprt;
|
|||
} \
|
||||
|
||||
#endif /* Q_OS_WIN32 */
|
||||
#else // define but disable this function if debugging is not set
|
||||
#define SCASSERT(cond) qt_noop();
|
||||
#endif /* QT_NO_DEBUG */
|
||||
|
||||
#endif // OPTIONS_H
|
||||
|
|
After Width: | Height: | Size: 756 B |
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/go-down.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/go-next.png
Normal file → Executable file
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/process-stop.png
Normal file → Executable file
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
src/app/share/resources/icons/win.icon.theme/32x32/actions/go-down.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
|
@ -39,9 +39,6 @@
|
|||
|
||||
#if defined __cplusplus
|
||||
/* Add C++ includes here */
|
||||
#ifdef Q_CC_MSVC
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
||||
#ifdef QT_CORE_LIB
|
||||
# include <QtCore>
|
||||
|
|
|
@ -97,7 +97,7 @@ void TableWindow::AddDetail()
|
|||
{
|
||||
tableScene->clearSelection();
|
||||
VItem* Detail = listDetails[indexDetail];
|
||||
Q_CHECK_PTR(Detail);
|
||||
SCASSERT(Detail != nullptr);
|
||||
connect(Detail, &VItem::itemOut, this, &TableWindow::itemOut);
|
||||
connect(Detail, &VItem::itemColliding, this, &TableWindow::itemColliding);
|
||||
connect(this, &TableWindow::LengthChanged, Detail, &VItem::LengthChanged);
|
||||
|
@ -329,7 +329,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
|||
if (lis.size()-2 <= 0)
|
||||
{
|
||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
|
||||
Q_CHECK_PTR(bitem);
|
||||
SCASSERT(bitem != nullptr);
|
||||
bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
||||
listCollidingItems.removeAt(i);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
|||
else if (listCollidingItems.size()==1)
|
||||
{
|
||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
|
||||
Q_CHECK_PTR(bitem);
|
||||
SCASSERT(bitem != nullptr);
|
||||
bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
||||
listCollidingItems.clear();
|
||||
collidingItems = true;
|
||||
|
|
|
@ -124,6 +124,25 @@ void VDrawTool::FullUpdateFromGui(int result)
|
|||
dialog = nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::FullUpdateFromGuiApply()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
SaveDialog(domElement);
|
||||
|
||||
emit FullUpdateTree();
|
||||
emit toolhaveChange();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::DialogLinkDestroy()
|
||||
{
|
||||
this->dialog=nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetFactor set current scale factor of scene.
|
||||
|
@ -170,9 +189,9 @@ qreal VDrawTool::CheckFormula(QString &formula, VContainer *data)
|
|||
//Need delete dialog here because parser in dialog don't allow use correct separator for parsing here.
|
||||
//Don't know why.
|
||||
delete dialog;
|
||||
Calculator *cal = new Calculator(data);
|
||||
result = cal->EvalFormula(formula);
|
||||
delete cal;//Here can be memory leak, but dialog already check this formula and probability very low.
|
||||
Calculator *cal1 = new Calculator(data);
|
||||
result = cal1->EvalFormula(formula);
|
||||
delete cal1;//Here can be memory leak, but dialog already check this formula and probability very low.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#define VDRAWTOOL_H
|
||||
|
||||
#include "../vabstracttool.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QGraphicsSceneContextMenuEvent>
|
||||
#include <QGraphicsView>
|
||||
|
@ -51,6 +50,10 @@ public:
|
|||
|
||||
/** @brief setDialog set dialog when user want change tool option. */
|
||||
virtual void setDialog() {}
|
||||
/**
|
||||
* @brief DialogLinkDestroy removes dialog pointer
|
||||
*/
|
||||
virtual void DialogLinkDestroy();
|
||||
|
||||
void ignoreContextMenu(bool enable);
|
||||
static qreal CheckFormula(QString &formula, VContainer *data);
|
||||
|
@ -59,6 +62,10 @@ public slots:
|
|||
virtual void ChangedActivDraw(const QString &newName);
|
||||
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
/**
|
||||
* @brief FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog
|
||||
*/
|
||||
virtual void FullUpdateFromGuiApply();
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
/** @brief ignoreContextMenuEvent ignore or not context menu events. */
|
||||
|
@ -119,6 +126,7 @@ protected:
|
|||
connect(qobject_cast< VMainGraphicsScene * >(tool->scene()),
|
||||
&VMainGraphicsScene::ChoosedObject, dialog, &DialogTool::ChoosedObject);
|
||||
connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGui);
|
||||
connect(dialog, &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply);
|
||||
if (ignoreFullUpdate == false)
|
||||
{
|
||||
connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList);
|
||||
|
|
|
@ -133,9 +133,9 @@ void VToolAlongLine::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolAlongLine::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
|
@ -146,9 +146,9 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolAlongLine::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formula);
|
||||
|
@ -158,22 +158,28 @@ void VToolAlongLine::setDialog()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
|
||||
VToolAlongLine *point=nullptr;
|
||||
point = Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
|
||||
VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||
|
@ -212,5 +218,7 @@ void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const Q
|
|||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolAlongLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
|
||||
static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Valentina::Sources &typeCreation);
|
||||
|
|
|
@ -63,9 +63,9 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||
dialogTool->SetCenter(arc->GetCenter().id());
|
||||
dialogTool->SetF1(arc->GetFormulaF1());
|
||||
|
@ -74,20 +74,26 @@ void VToolArc::setDialog()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 center = dialogTool->GetCenter();
|
||||
QString radius = dialogTool->GetRadius();
|
||||
QString f1 = dialogTool->GetF1();
|
||||
QString f2 = dialogTool->GetF2();
|
||||
Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Valentina::FromGui);
|
||||
VToolArc* point = nullptr;
|
||||
point=Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, QString &f2,
|
||||
VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, QString &f2,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse,
|
||||
const Valentina::Sources &typeCreation)
|
||||
{
|
||||
|
@ -122,7 +128,9 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &radius,
|
|||
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
doc->AddTool(id, toolArc);
|
||||
doc->IncrementReferens(center);
|
||||
return toolArc;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -269,9 +277,9 @@ void VToolArc::keyReleaseEvent(QKeyEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
||||
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
|
||||
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
* @param doc dom document container
|
||||
* @param data container with variables
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool form GUI.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
static void Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, QString &f2,
|
||||
static VToolArc* Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, QString &f2,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse,
|
||||
const Valentina::Sources &typeCreation);
|
||||
static const QString TagName;
|
||||
|
|
|
@ -75,9 +75,9 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formula);
|
||||
|
@ -88,24 +88,30 @@ void VToolBisector::setDialog()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const quint32 thirdPointId = dialogTool->getThirdPointId();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data,
|
||||
VToolBisector *point = nullptr;
|
||||
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
|
||||
const QString &pointName, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
|
@ -146,7 +152,9 @@ void VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &f
|
|||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
doc->IncrementReferens(thirdPointId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -233,9 +241,9 @@ void VToolBisector::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolBisector* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
static void Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
|
||||
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document::Documents &parse,
|
||||
|
|
|
@ -69,9 +69,9 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutArc::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->setArcId(arcId, id);
|
||||
|
@ -79,20 +79,26 @@ void VToolCutArc::setDialog()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 arcId = dialogTool->getArcId();
|
||||
Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
|
||||
VToolCutArc* point = nullptr;
|
||||
point=Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
||||
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||
{
|
||||
|
@ -151,7 +157,9 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &f
|
|||
doc->AddTool(arc1id, point);
|
||||
doc->AddTool(arc2id, point);
|
||||
doc->IncrementReferens(arcId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -252,9 +260,9 @@ void VToolCutArc::RefreshGeometry()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutArc::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
static void Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
||||
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation);
|
||||
static const QString ToolType;
|
||||
|
|
|
@ -70,9 +70,9 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSpline::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->setSplineId(splineId, id);
|
||||
|
@ -83,9 +83,9 @@ void VToolCutSpline::setDialog()
|
|||
void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 splineId = dialogTool->getSplineId();
|
||||
|
@ -254,9 +254,9 @@ void VToolCutSpline::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSpline::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
|
||||
|
|
|
@ -71,9 +71,9 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSplinePath::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->setSplinePathId(splinePathId, id);
|
||||
|
@ -83,9 +83,9 @@ void VToolCutSplinePath::setDialog()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 splinePathId = dialogTool->getSplinePathId();
|
||||
|
@ -99,7 +99,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
|
|||
const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
|
||||
Q_CHECK_PTR(splPath);
|
||||
SCASSERT(splPath != nullptr);
|
||||
|
||||
const qreal result = CheckFormula(formula, data);
|
||||
|
||||
|
@ -329,9 +329,9 @@ void VToolCutSplinePath::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
|
||||
|
|
|
@ -55,9 +55,9 @@ VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id,
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolEndLine::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formula);
|
||||
|
@ -67,23 +67,29 @@ void VToolEndLine::setDialog()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data)
|
||||
VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formula = dialogTool->getFormula();
|
||||
const qreal angle = dialogTool->getAngle();
|
||||
const quint32 basePointId = dialogTool->getBasePointId();
|
||||
Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
|
||||
|
||||
VToolEndLine *point = nullptr;
|
||||
point=Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
|
||||
Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formula, const qreal &angle, const quint32 &basePointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||
|
@ -118,7 +124,9 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt
|
|||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -187,9 +195,9 @@ void VToolEndLine::RefreshDataInFile()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolEndLine::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
|
|
|
@ -63,8 +63,9 @@ public:
|
|||
* @param scene pointer to scene.
|
||||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
* @return the created tool
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -80,8 +81,9 @@ public:
|
|||
* @param data container with variables.
|
||||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
* @return the created tool
|
||||
*/
|
||||
static void Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx,
|
||||
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Valentina::Sources &typeCreation);
|
||||
|
|
|
@ -52,9 +52,9 @@ VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, con
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolHeight::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setBasePointId(basePointId, id);
|
||||
|
@ -67,9 +67,9 @@ void VToolHeight::setDialog()
|
|||
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
|
@ -199,9 +199,9 @@ void VToolHeight::RefreshDataInFile()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolHeight::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
||||
|
|
|
@ -64,9 +64,9 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
dialogTool->setFirstPoint(firstPoint);
|
||||
dialogTool->setSecondPoint(secondPoint);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
|
@ -75,9 +75,9 @@ void VToolLine::setDialog()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 firstPoint = dialogTool->getFirstPoint();
|
||||
const quint32 secondPoint = dialogTool->getSecondPoint();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
|
@ -89,9 +89,9 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin
|
|||
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||
{
|
||||
Q_CHECK_PTR(scene);
|
||||
Q_CHECK_PTR(doc);
|
||||
Q_CHECK_PTR(data);
|
||||
SCASSERT(scene != nullptr);
|
||||
SCASSERT(doc != nullptr);
|
||||
SCASSERT(data != nullptr);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Valentina::FromGui)
|
||||
{
|
||||
|
@ -245,9 +245,9 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
|
|
|
@ -54,9 +54,9 @@ VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qu
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setP1Line1(p1Line1);
|
||||
dialogTool->setP2Line1(p2Line1);
|
||||
|
@ -68,9 +68,9 @@ void VToolLineIntersect::setDialog()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 p1Line1Id = dialogTool->getP1Line1();
|
||||
const quint32 p2Line1Id = dialogTool->getP2Line1();
|
||||
const quint32 p1Line2Id = dialogTool->getP1Line2();
|
||||
|
@ -218,9 +218,9 @@ void VToolLineIntersect::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1()));
|
||||
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1()));
|
||||
|
|
|
@ -54,9 +54,9 @@ VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, con
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolNormal::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formula);
|
||||
|
@ -67,23 +67,29 @@ void VToolNormal::setDialog()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const qreal angle = dialogTool->getAngle();
|
||||
Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
|
||||
VToolNormal *point = nullptr;
|
||||
point=Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
|
||||
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document::Documents &parse,
|
||||
|
@ -122,7 +128,9 @@ void VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &fir
|
|||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -219,9 +227,9 @@ void VToolNormal::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolNormal::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolNormal* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
static void Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
static VToolNormal* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
|
||||
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document::Documents &parse,
|
||||
|
|
|
@ -54,9 +54,9 @@ VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfContact::setDialog()
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
dialogTool->setRadius(arcRadius);
|
||||
dialogTool->setCenter(center, id);
|
||||
|
@ -93,22 +93,28 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString radius = dialogTool->getRadius();
|
||||
const quint32 center = dialogTool->getCenter();
|
||||
const quint32 firstPointId = dialogTool->getFirstPoint();
|
||||
const quint32 secondPointId = dialogTool->getSecondPoint();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data,
|
||||
VToolPointOfContact *point = nullptr;
|
||||
point=Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Valentina::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 ¢er, const quint32 &firstPointId,
|
||||
VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 ¢er, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const QString &pointName, const qreal &mx,
|
||||
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Valentina::Sources &typeCreation)
|
||||
|
@ -152,7 +158,9 @@ void VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint
|
|||
doc->IncrementReferens(center);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -236,9 +244,9 @@ void VToolPointOfContact::RemoveReferens()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfContact::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
|
||||
Q_CHECK_PTR(dialogTool);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius());
|
||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter()));
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
*/
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolPointOfContact* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
/**
|
||||
* @brief Create help create tool.
|
||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
static void Create(const quint32 _id, QString &arcRadius, const quint32 ¢er,
|
||||
static VToolPointOfContact* Create(const quint32 _id, QString &arcRadius, const quint32 ¢er,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation);
|
||||
|
|