Merge with develop

This commit is contained in:
dismine 2013-10-29 19:50:05 +02:00
commit e4dd9c7b97
224 changed files with 10649 additions and 5092 deletions

View File

@ -22,3 +22,6 @@ latex/
# Ignore file used QtCreator for user profile.
*.pro.user
# Ignore file Qt translation.
*.qm

View File

@ -11,7 +11,8 @@ QT += core gui widgets xml svg
TARGET = Valentina
TEMPLATE = app
CONFIG -= debug_and_release debug_and_release_target
CONFIG += c++11
CONFIG += c++11 precompile_header
QMAKE_CXX = ccache g++
SOURCES += main.cpp\
mainwindow.cpp \
@ -95,7 +96,17 @@ SOURCES += main.cpp\
exception/vexceptionconversionerror.cpp \
exception/vexceptionemptyparameter.cpp \
exception/vexceptionobjecterror.cpp \
widgets/vapplication.cpp
widgets/vapplication.cpp \
exception/vexceptionuniqueid.cpp \
tools/drawTools/vtoolheight.cpp \
tools/modelingTools/vmodelingheight.cpp \
dialogs/dialogheight.cpp \
tools/drawTools/vtooltriangle.cpp \
tools/modelingTools/vmodelingtriangle.cpp \
dialogs/dialogtriangle.cpp \
dialogs/dialogpointofintersection.cpp \
tools/drawTools/vtoolpointofintersection.cpp \
tools/modelingTools/vmodelingpointofintersection.cpp
HEADERS += mainwindow.h \
widgets/vmaingraphicsscene.h \
@ -185,7 +196,18 @@ HEADERS += mainwindow.h \
exception/vexceptionconversionerror.h \
exception/vexceptionemptyparameter.h \
exception/vexceptionobjecterror.h \
widgets/vapplication.h
widgets/vapplication.h \
exception/vexceptionuniqueid.h \
tools/drawTools/vtoolheight.h \
tools/modelingTools/vmodelingheight.h \
dialogs/dialogheight.h \
tools/drawTools/vtooltriangle.h \
tools/modelingTools/vmodelingtriangle.h \
dialogs/dialogtriangle.h \
dialogs/dialogpointofintersection.h \
tools/drawTools/vtoolpointofintersection.h \
tools/modelingTools/vmodelingpointofintersection.h \
version.h
FORMS += mainwindow.ui \
dialogs/dialogsinglepoint.ui \
@ -203,7 +225,10 @@ FORMS += mainwindow.ui \
dialogs/dialoghistory.ui \
dialogs/dialogpointofcontact.ui \
dialogs/dialogdetail.ui \
tablewindow.ui
tablewindow.ui \
dialogs/dialogheight.ui \
dialogs/dialogtriangle.ui \
dialogs/dialogpointofintersection.ui
RESOURCES += \
icon.qrc \
@ -245,7 +270,7 @@ CONFIG(debug, debug|release){
QMAKE_EXTRA_COMPILERS += lrelease
lrelease.input = TRANSLATIONS
lrelease.output = ${QMAKE_FILE_BASE}.qm
lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${DESTDIR}${QMAKE_FILE_BASE}.qm
lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm "bin/"${QMAKE_FILE_BASE}.qm
lrelease.CONFIG += no_link target_predeps
}
@ -261,5 +286,3 @@ message(Data files: $$[QT_INSTALL_DATA])
message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
message(Settings: $$[QT_INSTALL_SETTINGS])
message(Examples: $$[QT_INSTALL_EXAMPLES])

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,7 +20,6 @@
****************************************************************************/
#include "calculator.h"
#include <QDebug>
#define DELIMITER 1
#define VARIABLE 2

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -22,15 +22,13 @@
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include <QString>
#include "vcontainer.h"
/**
* @brief The Calculator клас калькулятора формул лекал. Виконує розрахунок формул з підставлянням
* значеннь зміних.
*/
class Calculator
{
class Calculator{
public:
/**
* @brief Calculator конструктор класу. Використовується при розрахунку лекала.

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,21 +20,19 @@
****************************************************************************/
#include "vcontainer.h"
#include <QDebug>
#include "options.h"
#include <exception/vexceptionbadid.h>
qint64 VContainer::_id = 0;
VContainer::VContainer():base(QMap<QString, qint32>()), points(QMap<qint64, VPointF>()),
modelingPoints(QMap<qint64, VPointF>()),
standartTable(QMap<QString, VStandartTableCell>()), incrementTable(QMap<QString, VIncrementTableRow>()),
lengthLines(QMap<QString, qreal>()), lineAngles(QMap<QString, qreal>()), splines(QMap<qint64, VSpline>()),
modelingSplines(QMap<qint64, VSpline>()),
lengthSplines(QMap<QString, qreal>()), arcs(QMap<qint64, VArc>()), modelingArcs(QMap<qint64, VArc>()),
lengthArcs(QMap<QString, qreal>()),
splinePaths(QMap<qint64, VSplinePath>()), modelingSplinePaths(QMap<qint64, VSplinePath>()),
details(QMap<qint64, VDetail>()){
VContainer::VContainer():base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
modelingPoints(QHash<qint64, VPointF>()),
standartTable(QHash<QString, VStandartTableCell>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
modelingSplines(QHash<qint64, VSpline>()),
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), modelingArcs(QHash<qint64, VArc>()),
lengthArcs(QHash<QString, qreal>()),
splinePaths(QHash<qint64, VSplinePath>()), modelingSplinePaths(QHash<qint64, VSplinePath>()),
details(QHash<qint64, VDetail>()){
SetSize(500);
SetGrowth(1760);
CreateManTableIGroup ();
@ -45,15 +43,15 @@ VContainer &VContainer::operator =(const VContainer &data){
return *this;
}
VContainer::VContainer(const VContainer &data):base(QMap<QString, qint32>()), points(QMap<qint64, VPointF>()),
modelingPoints(QMap<qint64, VPointF>()),
standartTable(QMap<QString, VStandartTableCell>()), incrementTable(QMap<QString, VIncrementTableRow>()),
lengthLines(QMap<QString, qreal>()), lineAngles(QMap<QString, qreal>()), splines(QMap<qint64, VSpline>()),
modelingSplines(QMap<qint64, VSpline>()),
lengthSplines(QMap<QString, qreal>()), arcs(QMap<qint64, VArc>()), modelingArcs(QMap<qint64, VArc>()),
lengthArcs(QMap<QString, qreal>()),
splinePaths(QMap<qint64, VSplinePath>()), modelingSplinePaths(QMap<qint64, VSplinePath>()),
details(QMap<qint64, VDetail>()){
VContainer::VContainer(const VContainer &data):base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
modelingPoints(QHash<qint64, VPointF>()),
standartTable(QHash<QString, VStandartTableCell>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
modelingSplines(QHash<qint64, VSpline>()),
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), modelingArcs(QHash<qint64, VArc>()),
lengthArcs(QHash<QString, qreal>()),
splinePaths(QHash<qint64, VSplinePath>()), modelingSplinePaths(QHash<qint64, VSplinePath>()),
details(QHash<qint64, VDetail>()){
setData(data);
}
@ -64,7 +62,7 @@ void VContainer::setData(const VContainer &data){
standartTable = *data.DataStandartTable();
incrementTable = *data.DataIncrementTable();
lengthLines = *data.DataLengthLines();
lineAngles = *data.DataLengthArcs();
lineAngles = *data.DataLineAngles();
splines = *data.DataSplines();
modelingSplines = *data.DataModelingSplines();
lengthSplines = *data.DataLengthSplines();
@ -77,7 +75,7 @@ void VContainer::setData(const VContainer &data){
}
template <typename key, typename val>
val VContainer::GetObject(const QMap<key,val> &obj, key id){
val VContainer::GetObject(const QHash<key, val> &obj, key id){
if(obj.contains(id)){
return obj.value(id);
} else {
@ -85,15 +83,6 @@ val VContainer::GetObject(const QMap<key,val> &obj, key id){
}
}
VPointF VContainer::GetPoint(qint64 id) const{
return GetObject(points, id);
}
VPointF VContainer::GetModelingPoint(qint64 id) const{
return GetObject(modelingPoints, id);
}
VStandartTableCell VContainer::GetStandartTableCell(const QString &name) const{
Q_ASSERT(!name.isEmpty());
return GetObject(standartTable, name);
@ -109,49 +98,31 @@ qreal VContainer::GetLine(const QString &name) const{
return GetObject(lengthLines, name);
}
qreal VContainer::GetLineArc(const QString &name) const{
qreal VContainer::GetLengthArc(const QString &name) const{
Q_ASSERT(!name.isEmpty());
return GetObject(lengthArcs, name);
}
qreal VContainer::GetLengthSpline(const QString &name) const{
Q_ASSERT(!name.isEmpty());
return GetObject(lengthSplines, name);
}
qreal VContainer::GetLineAngle(const QString &name) const{
Q_ASSERT(!name.isEmpty());
return GetObject(lineAngles, name);
}
VSpline VContainer::GetSpline(qint64 id) const{
return GetObject(splines, id);
qint64 VContainer::AddPoint(const VPointF &point){
return AddObject(points, point);
}
VSpline VContainer::GetModelingSpline(qint64 id) const{
return GetObject(modelingSplines, id);
qint64 VContainer::AddModelingPoint(const VPointF &point){
return AddObject(modelingPoints, point);
}
VArc VContainer::GetArc(qint64 id) const{
return GetObject(arcs, id);
}
VArc VContainer::GetModelingArc(qint64 id) const{
return GetObject(modelingArcs, id);
}
VSplinePath VContainer::GetSplinePath(qint64 id) const{
return GetObject(splinePaths, id);
}
VSplinePath VContainer::GetModelingSplinePath(qint64 id) const{
return GetObject(modelingSplinePaths, id);
}
VDetail VContainer::GetDetail(qint64 id) const{
return GetObject(details, id);
}
void VContainer::AddStandartTableCell(const QString& name, const VStandartTableCell& cell){
standartTable[name] = cell;
}
void VContainer::AddIncrementTableRow(const QString& name, const VIncrementTableRow& cell){
incrementTable[name] = cell;
}
qint64 VContainer::getId(){
return _id;
qint64 VContainer::AddDetail(const VDetail &detail){
return AddObject(details, detail);
}
qint64 VContainer::getNextId(){
@ -168,11 +139,18 @@ void VContainer::UpdateId(qint64 newId){
QPainterPath VContainer::ContourPath(qint64 idDetail) const{
VDetail detail = GetDetail(idDetail);
QVector<QPointF> points;
QVector<QPointF> pointsEkv;
for(qint32 i = 0; i< detail.CountNode(); ++i){
switch(detail[i].getTypeTool()){
case(Tool::NodePoint):{
VPointF point = GetModelingPoint(detail[i].getId());
points.append(point.toQPointF());
if(detail.getSupplement() == true){
QPointF pEkv = point.toQPointF();
pEkv.setX(pEkv.x()+detail[i].getMx());
pEkv.setY(pEkv.y()+detail[i].getMy());
pointsEkv.append(pEkv);
}
}
break;
case(Tool::NodeArc):{
@ -181,8 +159,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
if(len1 <= lenReverse){
points << arc.GetPoints();
if(detail.getSupplement() == true){
pointsEkv << biasPoints(arc.GetPoints(), detail[i].getMx(), detail[i].getMy());
}
} else {
points << GetReversePoint(arc.GetPoints());
if(detail.getSupplement() == true){
pointsEkv << biasPoints(GetReversePoint(arc.GetPoints()), detail[i].getMx(),
detail[i].getMy());
}
}
}
break;
@ -192,8 +177,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
if(len1 <= lenReverse){
points << spline.GetPoints();
if(detail.getSupplement() == true){
pointsEkv << biasPoints(spline.GetPoints(), detail[i].getMx(), detail[i].getMy());
}
} else {
points << GetReversePoint(spline.GetPoints());
if(detail.getSupplement() == true){
pointsEkv << biasPoints(GetReversePoint(spline.GetPoints()), detail[i].getMx(),
detail[i].getMy());
}
}
}
break;
@ -203,27 +195,57 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
if(len1 <= lenReverse){
points << splinePath.GetPathPoints();
if(detail.getSupplement() == true){
pointsEkv << biasPoints(splinePath.GetPathPoints(), detail[i].getMx(), detail[i].getMy());
}
} else {
points << GetReversePoint(splinePath.GetPathPoints());
if(detail.getSupplement() == true){
pointsEkv << biasPoints(GetReversePoint(splinePath.GetPathPoints()), detail[i].getMx(),
detail[i].getMy());
}
}
}
break;
case(Tool::SplineTool):
break;//Nothing to do, just ignore.
default:
qWarning()<<"Get wrong tool type. Ignore."<<detail[i].getTypeTool();
break;
}
}
QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10));
QPainterPath path;
path.moveTo(points[0]);
for (qint32 i = 1; i < points.count(); ++i){
path.lineTo(points[i]);
}
path.lineTo(points[0]);
if(detail.getSupplement() == true){
QPainterPath ekv;
if(detail.getClosed() == true){
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth()));
} else {
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth()));
}
path.addPath(ekv);
path.setFillRule(Qt::WindingFill);
}
return path;
}
QVector<QPointF> VContainer::biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const{
QVector<QPointF> p;
for(qint32 i = 0; i < points.size(); ++i){
QPointF point = points.at(i);
point.setX(point.x() + mx);
point.setY(point.x() + my);
p.append(point);
}
return p;
}
QPainterPath VContainer::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
const qreal &width) const{
QPainterPath ekv;
@ -377,75 +399,27 @@ QVector<QPointF> VContainer::CheckLoops(const QVector<QPointF> &points) const{
}
void VContainer::PrepareDetails(QVector<VItem *> &list) const{
QMapIterator<qint64, VDetail> iDetail(details);
QHashIterator<qint64, VDetail> iDetail(details);
while (iDetail.hasNext()) {
iDetail.next();
list.append(new VItem(ContourPath(iDetail.key()), list.size()));
}
}
void VContainer::RemoveIncrementTableRow(const QString& name){
incrementTable.remove(name);
}
template <typename val>
void VContainer::UpdateObject(QMap<qint64, val> &obj, const qint64 &id, const val& point){
void VContainer::UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point){
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
obj[id] = point;
UpdateId(id);
}
void VContainer::UpdatePoint(qint64 id, const VPointF& point){
UpdateObject(points, id, point);
}
void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){
UpdateObject(modelingPoints, id, point);
}
void VContainer::UpdateDetail(qint64 id, const VDetail &detail){
UpdateObject(details, id, detail);
}
void VContainer::UpdateSpline(qint64 id, const VSpline &spl){
UpdateObject(splines, id, spl);
}
void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){
UpdateObject(modelingSplines, id, spl);
}
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(splinePaths, id, splPath);
}
void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(modelingSplinePaths, id, splPath);
}
void VContainer::UpdateArc(qint64 id, const VArc &arc){
UpdateObject(arcs, id, arc);
}
void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){
UpdateObject(modelingArcs, id, arc);
}
void VContainer::UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell){
standartTable[name] = cell;
}
void VContainer::UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell){
incrementTable[name] = cell;
}
void VContainer::AddLengthSpline(const QString &name, const qreal &value){
Q_ASSERT(!name.isEmpty());
lengthSplines[name] = value;
}
void VContainer::AddLengthArc(const qint64 &center, const qint64 &id){
AddLengthArc(GetNameArc(center, id), GetArc(id).GetLength());
AddLengthArc(GetNameArc(center, id), toMM(GetArc(id).GetLength()));
}
void VContainer::AddLengthArc(const QString &name, const qreal &value){
@ -497,46 +471,6 @@ void VContainer::ClearObject(){
splinePaths.clear();
}
void VContainer::ClearIncrementTable(){
incrementTable.clear();
}
void VContainer::ClearLengthLines(){
lengthLines.clear();
}
void VContainer::ClearLengthSplines(){
lengthSplines.clear();
}
void VContainer::ClearLengthArcs(){
lengthArcs.clear();
}
void VContainer::ClearLineAngles(){
lineAngles.clear();
}
void VContainer::SetSize(qint32 size){
base["Сг"] = size;
}
void VContainer::SetGrowth(qint32 growth){
base["Р"] = growth;
}
qint32 VContainer::size() const{
return base.value("Сг");
}
qint32 VContainer::growth() const{
return base.value("Р");
}
bool VContainer::IncrementTableContains(const QString& name){
return incrementTable.contains(name);
}
qreal VContainer::FindVar(const QString &name, bool *ok)const{
if(base.contains(name)){
*ok = true;
@ -563,74 +497,14 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const{
*ok = true;
return lineAngles.value(name);
}
if(lengthSplines.contains(name)){
*ok = true;
return lengthSplines.value(name);
}
*ok = false;
return 0;
}
const QMap<qint64, VPointF> *VContainer::DataPoints() const{
return &points;
}
const QMap<qint64, VPointF> *VContainer::DataModelingPoints() const{
return &modelingPoints;
}
const QMap<qint64, VSpline> *VContainer::DataSplines() const{
return &splines;
}
const QMap<qint64, VSpline> *VContainer::DataModelingSplines() const{
return &modelingSplines;
}
const QMap<qint64, VArc> *VContainer::DataArcs() const{
return &arcs;
}
const QMap<qint64, VArc> *VContainer::DataModelingArcs() const{
return &modelingArcs;
}
const QMap<QString, qint32> *VContainer::DataBase() const{
return &base;
}
const QMap<QString, VStandartTableCell> *VContainer::DataStandartTable() const{
return &standartTable;
}
const QMap<QString, VIncrementTableRow> *VContainer::DataIncrementTable() const{
return &incrementTable;
}
const QMap<QString, qreal> *VContainer::DataLengthLines() const{
return &lengthLines;
}
const QMap<QString, qreal> *VContainer::DataLengthSplines() const{
return &lengthSplines;
}
const QMap<QString, qreal> *VContainer::DataLengthArcs() const{
return &lengthArcs;
}
const QMap<QString, qreal> *VContainer::DataLineAngles() const{
return &lineAngles;
}
const QMap<qint64, VSplinePath> *VContainer::DataSplinePaths() const{
return &splinePaths;
}
const QMap<qint64, VSplinePath> *VContainer::DataModelingSplinePaths() const{
return &modelingSplinePaths;
}
const QMap<qint64, VDetail> *VContainer::DataDetails() const{
return &details;
}
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameLine(firstPointId, secondPointId, mode);
VPointF first;
@ -642,30 +516,11 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId
first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId);
}
AddLengthLine(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length()/PrintDPI*25.4);
AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
nameLine = GetNameLineAngle(firstPointId, secondPointId, mode);
AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle());
}
template <typename key, typename val>
qint64 VContainer::AddObject(QMap<key, val> &obj, const val& value){
qint64 id = getNextId();
obj[id] = value;
return id;
}
qint64 VContainer::AddPoint(const VPointF& point){
return AddObject(points, point);
}
qint64 VContainer::AddModelingPoint(const VPointF &point){
return AddObject(modelingPoints, point);
}
qint64 VContainer::AddDetail(const VDetail &detail){
return AddObject(details, detail);
}
qint64 VContainer::AddSpline(const VSpline &spl){
return AddObject(splines, spl);
}
@ -690,6 +545,13 @@ qint64 VContainer::AddModelingArc(const VArc &arc){
return AddObject(modelingArcs, arc);
}
template <typename key, typename val>
qint64 VContainer::AddObject(QHash<key, val> &obj, const val& value){
qint64 id = getNextId();
obj[id] = value;
return id;
}
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode) const{
VPointF first;
VPointF second;
@ -760,7 +622,43 @@ QString VContainer::GetNameArc(const qint64 &center, const qint64 &id, Draw::Dra
} else {
centerPoint = GetModelingPoint(center);
}
return QString ("Arc(%1)%2").arg(centerPoint.name()).arg(id);
return QString ("Arc_%1_%2").arg(centerPoint.name()).arg(id);
}
void VContainer::UpdatePoint(qint64 id, const VPointF &point){
UpdateObject(points, id, point);
}
void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){
UpdateObject(modelingPoints, id, point);
}
void VContainer::UpdateDetail(qint64 id, const VDetail &detail){
UpdateObject(details, id, detail);
}
void VContainer::UpdateSpline(qint64 id, const VSpline &spl){
UpdateObject(splines, id, spl);
}
void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){
UpdateObject(modelingSplines, id, spl);
}
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(splinePaths, id, splPath);
}
void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(modelingSplinePaths, id, splPath);
}
void VContainer::UpdateArc(qint64 id, const VArc &arc){
UpdateObject(arcs, id, arc);
}
void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){
UpdateObject(modelingArcs, id, arc);
}
void VContainer::AddLengthLine(const QString &name, const qreal &value){
@ -768,20 +666,6 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value){
lengthLines[name] = value;
}
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameSpline(firstPointId, secondPointId, mode);
VPointF first;
VPointF second;
if(mode == Draw::Calculation){
first = GetPoint(firstPointId);
second = GetPoint(secondPointId);
} else {
first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId);
}
AddLengthSpline(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length());
}
void VContainer::CreateManTableIGroup (){
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
@ -795,18 +679,17 @@ void VContainer::CreateManTableIGroup (){
AddStandartTableCell("Vzy", VStandartTableCell(1328, 0, 49));
AddStandartTableCell("Vlop", VStandartTableCell(1320, 0, 49));
AddStandartTableCell("Vps", VStandartTableCell(811, -1, 36));
AddStandartTableCell("Osh", VStandartTableCell(404,8, 2));
AddStandartTableCell("OgI", VStandartTableCell(1034, 36, 4));
AddStandartTableCell("OgII", VStandartTableCell(1044, 38, 2));
AddStandartTableCell("OgIII", VStandartTableCell(1000, 40, 0));
AddStandartTableCell("Ot", VStandartTableCell(780, 40, 0));
AddStandartTableCell("Ob", VStandartTableCell(984, 30, 10));
AddStandartTableCell("ObI", VStandartTableCell(964, 24, 12));
AddStandartTableCell("Ssh", VStandartTableCell(202,4, 1));
AddStandartTableCell("SgI", VStandartTableCell(517, 18, 2));
AddStandartTableCell("SgII", VStandartTableCell(522, 19, 1));
AddStandartTableCell("SgIII", VStandartTableCell(500, 20, 0));
AddStandartTableCell("St", VStandartTableCell(390, 20, 0));
AddStandartTableCell("Sb", VStandartTableCell(492, 15, 5));
AddStandartTableCell("SbI", VStandartTableCell(482, 12, 6));
AddStandartTableCell("Obed", VStandartTableCell(566, 18, 6));
AddStandartTableCell("Ok", VStandartTableCell(386, 8, 8));
AddStandartTableCell("Oi", VStandartTableCell(380, 8, 6));
AddStandartTableCell("Osch", VStandartTableCell(234, 4, 4));
AddStandartTableCell("Os", VStandartTableCell(350, 2, 8));
AddStandartTableCell("Dsb", VStandartTableCell(1120, 0, 44));
AddStandartTableCell("Dsp", VStandartTableCell(1110, 0, 43));
AddStandartTableCell("Dn", VStandartTableCell(826, -3, 37));

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -22,20 +22,17 @@
#ifndef VCONTAINER_H
#define VCONTAINER_H
#include <QTableWidget>
#include "vstandarttablecell.h"
#include "vincrementtablerow.h"
#include "geometry/varc.h"
#include "geometry/vsplinepath.h"
#include "geometry/vdetail.h"
#include "widgets/vitem.h"
#include <QCoreApplication>
/**
* @brief The VContainer class
*/
class VContainer
{
class VContainer{
Q_DECLARE_TR_FUNCTIONS(VContainer)
public:
/**
@ -50,28 +47,30 @@ public:
* @param id
* @return
*/
VPointF GetPoint(qint64 id) const;
VPointF GetModelingPoint(qint64 id) const;
inline VPointF GetPoint(qint64 id) const {return GetObject(points, id);}
inline VPointF GetModelingPoint(qint64 id) const {return GetObject(modelingPoints, id);}
VStandartTableCell GetStandartTableCell(const QString& name) const;
VIncrementTableRow GetIncrementTableRow(const QString& name) const;
qreal GetLine(const QString &name) const;
qreal GetLineArc(const QString &name) const;
VSpline GetSpline(qint64 id) const;
VSpline GetModelingSpline(qint64 id) const;
VArc GetArc(qint64 id) const;
VArc GetModelingArc(qint64 id) const;
VSplinePath GetSplinePath(qint64 id) const;
VSplinePath GetModelingSplinePath(qint64 id) const;
VDetail GetDetail(qint64 id) const;
static qint64 getId();
qreal GetLengthArc(const QString &name) const;
qreal GetLengthSpline(const QString &name) const;
qreal GetLineAngle(const QString &name) const;
inline VSpline GetSpline(qint64 id) const {return GetObject(splines, id);}
inline VSpline GetModelingSpline(qint64 id) const {return GetObject(modelingSplines, id);}
inline VArc GetArc(qint64 id) const {return GetObject(arcs, id);}
inline VArc GetModelingArc(qint64 id) const {return GetObject(modelingArcs, id);}
inline VSplinePath GetSplinePath(qint64 id) const {return GetObject(splinePaths, id);}
inline VSplinePath GetModelingSplinePath(qint64 id) const {return GetObject(modelingSplinePaths, id);}
inline VDetail GetDetail(qint64 id) const {return GetObject(details, id);}
static qint64 getId() {return _id;}
qint64 AddPoint(const VPointF& point);
qint64 AddModelingPoint(const VPointF& point);
qint64 AddDetail(const VDetail& detail);
void AddStandartTableCell(const QString& name, const VStandartTableCell& cell);
void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell);
inline void AddStandartTableCell(const QString& name, const VStandartTableCell& cell)
{standartTable[name] = cell;}
inline void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell)
{incrementTable[name] = cell;}
void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId,
Draw::Draws mode = Draw::Calculation);
void AddLengthSpline(const QString &name, const qreal &value);
void AddLengthArc(const qint64 &center, const qint64 &id);
void AddLengthArc(const QString &name, const qreal &value);
@ -92,8 +91,7 @@ public:
Draw::Draws mode = Draw::Calculation) const;
QString GetNameSplinePath(const VSplinePath &path,
Draw::Draws mode = Draw::Calculation) const;
QString GetNameArc(const qint64 &center, const qint64 &id,
Draw::Draws mode = Draw::Calculation) const;
QString GetNameArc(const qint64 &center, const qint64 &id, Draw::Draws mode = Draw::Calculation) const;
void UpdatePoint(qint64 id, const VPointF& point);
void UpdateModelingPoint(qint64 id, const VPointF& point);
void UpdateDetail(qint64 id, const VDetail& detail);
@ -103,45 +101,47 @@ public:
void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath);
void UpdateArc(qint64 id, const VArc& arc);
void UpdateModelingArc(qint64 id, const VArc& arc);
void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell);
void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell);
inline void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell)
{standartTable[name] = cell;}
inline void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell)
{incrementTable[name] = cell;}
qreal GetValueStandartTableCell(const QString& name) const;
qreal GetValueIncrementTableRow(const QString& name) const;
void Clear();
void ClearObject();
void ClearIncrementTable();
void ClearLengthLines();
void ClearLengthSplines();
void ClearLengthArcs();
void ClearLineAngles();
void SetSize(qint32 size);
void SetGrowth(qint32 growth);
qint32 size() const;
qint32 growth() const;
inline void ClearIncrementTable() {incrementTable.clear();}
inline void ClearLengthLines() {lengthLines.clear();}
inline void ClearLengthSplines() {lengthSplines.clear();}
inline void ClearLengthArcs() {lengthArcs.clear();}
inline void ClearLineAngles() {lineAngles.clear();}
inline void SetSize(qint32 size) {base["Сг"] = size;}
inline void SetGrowth(qint32 growth) {base["Р"] = growth;}
inline qint32 size() const {return base.value("Сг");}
inline qint32 growth() const {return base.value("Р");}
qreal FindVar(const QString& name, bool *ok)const;
bool IncrementTableContains(const QString& name);
inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);}
static qint64 getNextId();
void RemoveIncrementTableRow(const QString& name);
const QMap<qint64, VPointF> *DataPoints() const;
const QMap<qint64, VPointF> *DataModelingPoints() const;
const QMap<qint64, VSpline> *DataSplines() const;
const QMap<qint64, VSpline> *DataModelingSplines() const;
const QMap<qint64, VArc> *DataArcs() const;
const QMap<qint64, VArc> *DataModelingArcs() const;
const QMap<QString, qint32> *DataBase() const;
const QMap<QString, VStandartTableCell> *DataStandartTable() const;
const QMap<QString, VIncrementTableRow> *DataIncrementTable() const;
const QMap<QString, qreal> *DataLengthLines() const;
const QMap<QString, qreal> *DataLengthSplines() const;
const QMap<QString, qreal> *DataLengthArcs() const;
const QMap<QString, qreal> *DataLineAngles() const;
const QMap<qint64, VSplinePath> *DataSplinePaths() const;
const QMap<qint64, VSplinePath> *DataModelingSplinePaths() const;
const QMap<qint64, VDetail> *DataDetails() const;
inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);}
inline const QHash<qint64, VPointF> *DataPoints() const {return &points;}
inline const QHash<qint64, VPointF> *DataModelingPoints() const {return &modelingPoints;}
inline const QHash<qint64, VSpline> *DataSplines() const {return &splines;}
inline const QHash<qint64, VSpline> *DataModelingSplines() const {return &modelingSplines;}
inline const QHash<qint64, VArc> *DataArcs() const {return &arcs;}
inline const QHash<qint64, VArc> *DataModelingArcs() const {return &modelingArcs;}
inline const QHash<QString, qint32> *DataBase() const {return &base;}
inline const QHash<QString, VStandartTableCell> *DataStandartTable() const {return &standartTable;}
inline const QHash<QString, VIncrementTableRow> *DataIncrementTable() const {return &incrementTable;}
inline const QHash<QString, qreal> *DataLengthLines() const {return &lengthLines;}
inline const QHash<QString, qreal> *DataLengthSplines() const {return &lengthSplines;}
inline const QHash<QString, qreal> *DataLengthArcs() const {return &lengthArcs;}
inline const QHash<QString, qreal> *DataLineAngles() const {return &lineAngles;}
inline const QHash<qint64, VSplinePath> *DataSplinePaths() const {return &splinePaths;}
inline const QHash<qint64, VSplinePath> *DataModelingSplinePaths() const {return &modelingSplinePaths;}
inline const QHash<qint64, VDetail> *DataDetails() const {return &details;}
static void UpdateId(qint64 newId);
QPainterPath ContourPath(qint64 idDetail) const;
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
const qreal &width)const;
QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const;
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, const qreal &width)const;
static QLineF ParallelLine(const QLineF &line, qreal width );
static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width);
QVector<QPointF> EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const;
@ -149,29 +149,28 @@ public:
void PrepareDetails(QVector<VItem *> & list) const;
private:
static qint64 _id;
QMap<QString, qint32> base;
QMap<qint64, VPointF> points;
QMap<qint64, VPointF> modelingPoints;
QMap<QString, VStandartTableCell> standartTable;
QMap<QString, VIncrementTableRow> incrementTable;
QMap<QString, qreal> lengthLines;
QMap<QString, qreal> lineAngles;
QMap<qint64, VSpline> splines;
QMap<qint64, VSpline> modelingSplines;
QMap<QString, qreal> lengthSplines;
QMap<qint64, VArc> arcs;
QMap<qint64, VArc> modelingArcs;
QMap<QString, qreal> lengthArcs;
QMap<qint64, VSplinePath> splinePaths;
QMap<qint64, VSplinePath> modelingSplinePaths;
QMap<qint64, VDetail> details;
template <typename key, typename val> static val GetObject(const QMap<key,val> &obj, key id);
template <typename val> static void UpdateObject(QMap<qint64, val> &obj, const qint64 &id,
const val& point);
template <typename key, typename val> static qint64 AddObject(QMap<key, val> &obj, const val& value);
QHash<QString, qint32> base;
QHash<qint64, VPointF> points;
QHash<qint64, VPointF> modelingPoints;
QHash<QString, VStandartTableCell> standartTable;
QHash<QString, VIncrementTableRow> incrementTable;
QHash<QString, qreal> lengthLines;
QHash<QString, qreal> lineAngles;
QHash<qint64, VSpline> splines;
QHash<qint64, VSpline> modelingSplines;
QHash<QString, qreal> lengthSplines;
QHash<qint64, VArc> arcs;
QHash<qint64, VArc> modelingArcs;
QHash<QString, qreal> lengthArcs;
QHash<qint64, VSplinePath> splinePaths;
QHash<qint64, VSplinePath> modelingSplinePaths;
QHash<qint64, VDetail> details;
void CreateManTableIGroup ();
QVector<QPointF> GetReversePoint(const QVector<QPointF> &points)const;
qreal GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)const;
template <typename key, typename val> static val GetObject(const QHash<key,val> &obj, key id);
template <typename val> static void UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point);
template <typename key, typename val> static qint64 AddObject(QHash<key, val> &obj, const val& value);
};
#endif // VCONTAINER_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -29,42 +29,4 @@ VIncrementTableRow::VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal
kgrowth(kgrowth), description(description){
}
QString VIncrementTableRow::getDescription() const{
return description;
}
void VIncrementTableRow::setDescription(const QString &value){
description = value;
}
qreal VIncrementTableRow::getKgrowth() const{
return kgrowth;
}
void VIncrementTableRow::setKgrowth(const qreal &value){
kgrowth = value;
}
qreal VIncrementTableRow::getKsize() const{
return ksize;
}
void VIncrementTableRow::setKsize(const qreal &value){
ksize = value;
}
qreal VIncrementTableRow::getBase() const{
return base;
}
void VIncrementTableRow::setBase(const qreal &value){
base = value;
}
qint64 VIncrementTableRow::getId() const{
return id;
}
void VIncrementTableRow::setId(const qint64 &value){
id = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -22,29 +22,21 @@
#ifndef VINCREMENTTABLEROW_H
#define VINCREMENTTABLEROW_H
#include <QString>
class VIncrementTableRow
{
class VIncrementTableRow{
public:
VIncrementTableRow();
VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth,
QString description = QString());
qint64 getId() const;
void setId(const qint64 &value);
qreal getBase() const;
void setBase(const qreal &value);
qreal getKsize() const;
void setKsize(const qreal &value);
qreal getKgrowth() const;
void setKgrowth(const qreal &value);
QString getDescription() const;
void setDescription(const QString &value);
inline qint64 getId() const {return id;}
inline void setId(const qint64 &value) {id = value;}
inline qreal getBase() const {return base;}
inline void setBase(const qreal &value) {base = value;}
inline qreal getKsize() const {return ksize;}
inline void setKsize(const qreal &value) {ksize = value;}
inline qreal getKgrowth() const {return kgrowth;}
inline void setKgrowth(const qreal &value) {kgrowth = value;}
inline QString getDescription() const {return description;}
inline void setDescription(const QString &value) {description = value;}
private:
qint64 id;
qreal base;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -22,10 +22,6 @@
#ifndef VPOINTF_H
#define VPOINTF_H
#include <QPointF>
#include <QString>
#include "options.h"
class VPointF{
public:
inline VPointF ()

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -27,19 +27,3 @@ VStandartTableCell::VStandartTableCell():base(0), ksize(0), kgrowth(0), descript
VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description):base(base),
ksize(ksize), kgrowth(kgrowth), description(description){
}
qint32 VStandartTableCell::GetBase() const{
return base;
}
qreal VStandartTableCell::GetKsize() const{
return ksize;
}
qreal VStandartTableCell::GetKgrowth() const{
return kgrowth;
}
QString VStandartTableCell::GetDescription() const{
return description;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -22,17 +22,14 @@
#ifndef VSTANDARTTABLECELL_H
#define VSTANDARTTABLECELL_H
#include <QString>
class VStandartTableCell
{
class VStandartTableCell{
public:
VStandartTableCell();
VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString());
qint32 GetBase() const;
qreal GetKsize() const;
qreal GetKgrowth() const;
QString GetDescription() const;
inline qint32 GetBase() const {return base;}
inline qreal GetKsize() const {return ksize;}
inline qreal GetKgrowth() const {return kgrowth;}
inline QString GetDescription() const {return description;}
private:
qint32 base;
qreal ksize;

View File

@ -12,5 +12,8 @@
<file>cursor/splinepath_cursor.png</file>
<file>cursor/pointcontact_cursor.png</file>
<file>cursor/new_detail_cursor.png</file>
<file>cursor/height_cursor.png</file>
<file>cursor/triangle_cursor.png</file>
<file>cursor/pointofintersect_cursor.png</file>
</qresource>
</RCC>

BIN
cursor/height_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
cursor/triangle_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -33,7 +33,11 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted);
@ -42,6 +46,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected);
FillComboBoxTypeLine(ui->comboBoxLineType);
ui->comboBoxLineType->setCurrentIndex(1);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
@ -54,13 +59,14 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogAlongLine::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogAlongLine::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogAlongLine::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogAlongLine::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged);
}
DialogAlongLine::~DialogAlongLine()
{
DialogAlongLine::~DialogAlongLine(){
delete ui;
}
@ -88,6 +94,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point of line"));
return;
}
}
@ -96,6 +103,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
@ -113,44 +121,24 @@ void DialogAlongLine::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
qint64 DialogAlongLine::getSecondPointId() const{
return secondPointId;
}
void DialogAlongLine::setSecondPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
qint64 DialogAlongLine::getFirstPointId() const{
return firstPointId;
}
void DialogAlongLine::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
QString DialogAlongLine::getFormula() const{
return formula;
}
void DialogAlongLine::setFormula(const QString &value){
formula = value;
ui->lineEditFormula->setText(formula);
}
QString DialogAlongLine::getTypeLine() const{
return typeLine;
}
void DialogAlongLine::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
QString DialogAlongLine::getPointName() const{
return pointName;
}
void DialogAlongLine::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,28 +23,26 @@
#define DIALOGALONGLINE_H
#include "dialogtool.h"
#include "container/calculator.h"
namespace Ui {
class DialogAlongLine;
}
class DialogAlongLine : public DialogTool
{
class DialogAlongLine : public DialogTool{
Q_OBJECT
public:
explicit DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogAlongLine();
QString getPointName() const;
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
QString getTypeLine() const;
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
QString getFormula() const;
inline QString getFormula() const {return formula;}
void setFormula(const QString &value);
qint64 getFirstPointId() const;
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const;
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,23 +24,67 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFormula"/>
<widget class="QLineEdit" name="lineEditFormula">
<property name="toolTip">
<string>Formula calculation of length of line</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -76,6 +120,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -90,7 +137,44 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelEditNamePoint">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -101,6 +185,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -128,7 +215,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFirstPoint"/>
<widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
@ -142,7 +233,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSecondPoint"/>
<widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>Second point of line</string>
</property>
</widget>
</item>
</layout>
</item>
@ -156,7 +251,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType"/>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
@ -203,7 +302,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of arcs</string>
@ -213,7 +312,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of curves</string>
@ -225,7 +324,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item>
</layout>
</item>
@ -248,6 +351,23 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,7 +21,6 @@
#include "dialogarc.h"
#include "ui_dialogarc.h"
#include "../container/calculator.h"
DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
@ -52,6 +51,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
@ -63,7 +64,9 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines);
connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineArcs);
connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogArc::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogArc::LengthCurves);
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);
@ -74,8 +77,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
}
qint64 DialogArc::GetCenter() const{
return center;
DialogArc::~DialogArc(){
delete ui;
}
void DialogArc::SetCenter(const qint64 &value){
@ -83,37 +86,21 @@ void DialogArc::SetCenter(const qint64 &value){
ChangeCurrentData(ui->comboBoxBasePoint, center);
}
QString DialogArc::GetF2() const{
return f2;
}
void DialogArc::SetF2(const QString &value){
f2 = value;
ui->lineEditF2->setText(f2);
}
QString DialogArc::GetF1() const{
return f1;
}
void DialogArc::SetF1(const QString &value){
f1 = value;
ui->lineEditF1->setText(f1);
}
QString DialogArc::GetRadius() const{
return radius;
}
void DialogArc::SetRadius(const QString &value){
radius = value;
ui->lineEditRadius->setText(radius);
}
DialogArc::~DialogArc(){
delete ui;
}
void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
@ -134,6 +121,7 @@ void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){
point = data->GetModelingPoint(id);
}
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
emit ToolTip("");
this->show();
}
}
@ -152,8 +140,8 @@ void DialogArc::ValChenged(int row){
}
QListWidgetItem *item = ui->listWidget->item( row );
if(ui->radioButtonLineAngles->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text()))
.arg("Значення кута лінії.");
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineAngle(item->text()))
.arg(tr("Value angle of line."));
ui->labelDescription->setText(desc);
return;
}
@ -172,45 +160,52 @@ void DialogArc::PutF2(){
PutValHere(ui->lineEditF2, ui->listWidget);
}
void DialogArc::LineArcs(){
ShowLineArcs();
void DialogArc::LineAngles(){
ShowLineAngles();
}
void DialogArc::RadiusChanged(){
labelEditFormula = ui->labelEditRadius;
ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius);
}
void DialogArc::F1Changed(){
labelEditFormula = ui->labelEditF1;
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
}
void DialogArc::F2Changed(){
labelEditFormula = ui->labelEditF2;
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
}
void DialogArc::CheckState(){
Q_CHECK_PTR(bOk);
Q_ASSERT(bOk != 0);
bOk->setEnabled(flagRadius && flagF1 && flagF2);
}
void DialogArc::EvalRadius(){
labelEditFormula = ui->labelEditRadius;
Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius);
}
void DialogArc::EvalF1(){
labelEditFormula = ui->labelEditF1;
Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1);
}
void DialogArc::EvalF2(){
labelEditFormula = ui->labelEditF2;
Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2);
}
void DialogArc::ShowLineArcs(){
void DialogArc::ShowLineAngles(){
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QMap<QString, qreal> *lineArcsTable = data->DataLineAngles();
QMapIterator<QString, qreal> i(*lineArcsTable);
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
Q_ASSERT(lineAnglesTable != 0);
QHashIterator<QString, qreal> i(*lineAnglesTable);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -28,24 +28,19 @@ namespace Ui {
class DialogArc;
}
class DialogArc : public DialogTool
{
class DialogArc : public DialogTool{
Q_OBJECT
public:
explicit DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogArc();
qint64 GetCenter() const;
inline qint64 GetCenter() const {return center;}
void SetCenter(const qint64 &value);
QString GetRadius() const;
inline QString GetRadius() const {return radius;}
void SetRadius(const QString &value);
QString GetF1() const;
inline QString GetF1() const {return f1;}
void SetF1(const QString &value);
QString GetF2() const;
inline QString GetF2() const {return f2;}
void SetF2(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
@ -53,7 +48,7 @@ public slots:
void PutRadius();
void PutF1();
void PutF2();
void LineArcs();
void LineAngles();
void RadiusChanged();
void F1Changed();
void F2Changed();
@ -75,7 +70,7 @@ private:
void EvalRadius();
void EvalF1();
void EvalF2();
void ShowLineArcs();
void ShowLineAngles();
};
#endif // DIALOGARC_H

View File

@ -24,13 +24,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditRadius">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Radius</string>
</property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Formula calculation of radius of arc</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereRadius">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -65,6 +108,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonEqualRadius">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -94,6 +140,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of radius</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -104,13 +153,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelEditF1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>First angle degree</string>
</property>
@ -124,10 +210,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>First angle of arc counterclockwise</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF1">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -145,6 +237,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonEqualF1">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -174,6 +269,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of first angle</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -184,13 +282,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelEditF2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Second angle degree</string>
</property>
@ -204,10 +339,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Second angle of arc counterclockwise</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF2">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -225,6 +366,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonEqualF2">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -254,6 +398,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of second angle</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -281,7 +428,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxBasePoint"/>
<widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>Select point of center of arc</string>
</property>
</widget>
</item>
</layout>
</item>
@ -344,7 +495,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Length of arcs</string>
<string>Length of curves</string>
</property>
</widget>
</item>
@ -363,7 +514,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables</string>
</property>
</widget>
</item>
</layout>
</item>
@ -386,6 +541,27 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditRadius</tabstop>
<tabstop>lineEditF1</tabstop>
<tabstop>lineEditF2</tabstop>
<tabstop>comboBoxBasePoint</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>radioButtonLineAngles</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHereRadius</tabstop>
<tabstop>toolButtonPutHereF1</tabstop>
<tabstop>toolButtonPutHereF2</tabstop>
<tabstop>toolButtonEqualRadius</tabstop>
<tabstop>toolButtonEqualF1</tabstop>
<tabstop>toolButtonEqualF2</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -33,7 +33,11 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted);
@ -55,6 +59,8 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogBisector::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogBisector::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogBisector::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogBisector::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged);
@ -88,6 +94,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point of angle"));
return;
}
}
@ -96,6 +103,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select third point of angle"));
return;
}
}
@ -104,6 +112,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxThirdPoint->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
@ -112,53 +121,29 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
}
}
QString DialogBisector::getPointName() const{
return pointName;
}
void DialogBisector::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
QString DialogBisector::getTypeLine() const{
return typeLine;
}
void DialogBisector::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
QString DialogBisector::getFormula() const{
return formula;
}
void DialogBisector::setFormula(const QString &value){
formula = value;
ui->lineEditFormula->setText(formula);
}
qint64 DialogBisector::getFirstPointId() const{
return firstPointId;
}
void DialogBisector::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
qint64 DialogBisector::getSecondPointId() const{
return secondPointId;
}
void DialogBisector::setSecondPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
qint64 DialogBisector::getThirdPointId() const{
return thirdPointId;
}
void DialogBisector::setThirdPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id);
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,32 +23,29 @@
#define DIALOGBISECTOR_H
#include "dialogtool.h"
#include <QListWidgetItem>
#include "container/calculator.h"
namespace Ui {
class DialogBisector;
}
class DialogBisector : public DialogTool
{
class DialogBisector : public DialogTool{
Q_OBJECT
public:
explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogBisector();
QString getPointName() const;
QString getPointName() const {return pointName;}
void setPointName(const QString &value);
QString getTypeLine() const;
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
QString getFormula() const;
inline QString getFormula() const {return formula;}
void setFormula(const QString &value);
qint64 getFirstPointId() const;
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const;
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
qint64 getThirdPointId() const;
inline qint64 getThirdPointId() const {return thirdPointId;}
void setThirdPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -21,13 +21,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length</string>
</property>
@ -41,10 +78,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Formula calculation of length of bisector</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -74,6 +117,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -88,13 +134,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -105,6 +188,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -138,7 +224,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFirstPoint"/>
<widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
@ -158,7 +248,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSecondPoint"/>
<widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>Second point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
@ -178,7 +272,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxThirdPoint"/>
<widget class="QComboBox" name="comboBoxThirdPoint">
<property name="toolTip">
<string>Third point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
@ -192,7 +290,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType"/>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from second point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
@ -242,7 +344,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of arcs</string>
@ -252,7 +354,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of curves</string>
@ -264,7 +366,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item>
</layout>
</item>
@ -290,6 +396,24 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>comboBoxThirdPoint</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,16 +20,26 @@
****************************************************************************/
#include "dialogdetail.h"
#include <QDebug>
DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(), details(VDetail()){
DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true){
ui.setupUi(this);
labelEditNamePoint = ui.labelEditNameDetail;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected);
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged);
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasYChanged);
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged);
}
void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
@ -59,7 +69,7 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour);
break;
default:
qWarning()<<"Get wrong scene object. Ignore.";
qWarning()<<tr("Get wrong scene object. Ignore.");
break;
}
this->show();
@ -72,11 +82,16 @@ void DialogDetail::DialogAccepted(){
QListWidgetItem *item = ui.listWidget->item(i);
details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
}
details.setWidth(ui.doubleSpinBoxSeams->value());
details.setName(ui.lineEditNameDetail->text());
details.setSupplement(supplement);
details.setClosed(closed);
emit ToolTip("");
emit DialogClosed(QDialog::Accepted);
}
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx,
qreal my){
QString name;
switch(typeTool){
case(Tool::NodePoint):{
@ -120,28 +135,74 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No
break;
}
default:
qWarning()<<"Get wrong tools. Ignore.";
qWarning()<<tr("Get wrong tools. Ignore.");
break;
}
QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(QFont("Times", 12, QFont::Bold));
VNodeDetail node(id, typeTool, mode, typeNode);
VNodeDetail node(id, typeTool, mode, typeNode, mx, my);
item->setData(Qt::UserRole, QVariant::fromValue(node));
ui.listWidget->addItem(item);
}
VDetail DialogDetail::getDetails() const{
return details;
disconnect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged);
disconnect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasYChanged);
ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy()));
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged);
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasYChanged);
}
void DialogDetail::setDetails(const VDetail &value){
details = value;
ui.listWidget->clear();
for(qint32 i = 0; i < details.CountNode(); ++i){
NewItem(details[i].getId(), details[i].getTypeTool(),details[i].getMode(), details[i].getTypeNode());
NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), details[i].getMx(),
details[i].getMy());
}
details.setName(ui.lineEditNameDetail->text());
ui.lineEditNameDetail->setText(details.getName());
ui.checkBoxSeams->setChecked(details.getSupplement());
ui.checkBoxClosed->setChecked(details.getClosed());
ui.doubleSpinBoxSeams->setValue(details.getWidth());
ui.listWidget->setCurrentRow(0);
ui.listWidget->setFocus(Qt::OtherFocusReason);
}
void DialogDetail::BiasXChanged(qreal d){
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMx(toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));
}
void DialogDetail::BiasYChanged(qreal d){
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMy(toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));
}
void DialogDetail::ClickedSeams(bool checked){
supplement = checked;
ui.checkBoxClosed->setEnabled(checked);
ui.doubleSpinBoxSeams->setEnabled(checked);
}
void DialogDetail::ClickedClosed(bool checked){
closed = checked;
}
void DialogDetail::ObjectChanged(int row){
if(ui.listWidget->count() == 0){
return;
}
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy()));
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -24,22 +24,28 @@
#include "ui_dialogdetail.h"
#include "dialogtool.h"
#include "geometry/vdetail.h"
class DialogDetail : public DialogTool{
Q_OBJECT
public:
explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
VDetail getDetails() const;
DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
inline VDetail getDetails() const {return details;}
void setDetails(const VDetail &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
void BiasXChanged(qreal d);
void BiasYChanged(qreal d);
void ClickedSeams(bool checked);
void ClickedClosed(bool checked);
void ObjectChanged(int row);
private:
Ui::DialogDetail ui;
VDetail details;
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode);
bool supplement;
bool closed;
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx = 0,
qreal my = 0);
};
#endif // DIALOGDETAIL_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>298</height>
<width>544</width>
<height>327</height>
</rect>
</property>
<property name="windowTitle">
@ -20,15 +20,158 @@
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Bias X</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasX">
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Bias Y</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasY">
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Option</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<widget class="QLabel" name="labelEditNameDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Name of detail</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNameDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSeams">
<property name="text">
<string>Supplement for seams</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -39,17 +182,22 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Name detail</string>
<string>Width</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNameDetail"/>
<widget class="QDoubleSpinBox" name="doubleSpinBoxSeams">
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="checkBoxClosed">
<property name="text">
@ -61,6 +209,7 @@
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
@ -81,6 +230,11 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditNameDetail</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,10 +21,6 @@
#include "dialogendline.h"
#include "ui_dialogendline.h"
#include <QCloseEvent>
#include <QString>
#include "container/vpointf.h"
#include "container/calculator.h"
DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
@ -38,7 +34,11 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted);
@ -74,6 +74,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogEndLine::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEndLine::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEndLine::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEndLine::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged);
@ -99,50 +101,31 @@ void DialogEndLine::ChoosedObject(qint64 id, Scene::Scenes type){
point = data->GetModelingPoint(id);
}
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
emit ToolTip("");
this->show();
}
}
QString DialogEndLine::getPointName() const{
return pointName;
}
void DialogEndLine::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
QString DialogEndLine::getTypeLine() const{
return typeLine;
}
void DialogEndLine::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
QString DialogEndLine::getFormula() const{
return formula;
}
void DialogEndLine::setFormula(const QString &value){
formula = value;
ui->lineEditFormula->setText(formula);
}
qreal DialogEndLine::getAngle() const{
return angle;
}
void DialogEndLine::setAngle(const qreal &value){
angle = value;
ui->doubleSpinBoxAngle->setValue(angle);
}
qint64 DialogEndLine::getBasePointId() const{
return basePointId;
}
void DialogEndLine::setBasePointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id);
}
@ -156,7 +139,6 @@ void DialogEndLine::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
DialogEndLine::~DialogEndLine()
{
DialogEndLine::~DialogEndLine(){
delete ui;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,29 +23,26 @@
#define DIALOGENDLINE_H
#include "dialogtool.h"
#include <QListWidgetItem>
#include "container/calculator.h"
namespace Ui {
class DialogEndLine;
}
class DialogEndLine : public DialogTool
{
class DialogEndLine : public DialogTool{
Q_OBJECT
public:
explicit DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogEndLine();
QString getPointName() const;
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
QString getTypeLine() const;
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
QString getFormula() const;
inline QString getFormula() const {return formula;}
void setFormula(const QString &value);
qreal getAngle() const;
inline qreal getAngle() const {return angle;}
void setAngle(const qreal &value);
qint64 getBasePointId() const;
inline qint64 getBasePointId() const {return basePointId;}
void setBasePointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length</string>
</property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Formula calculation of length of line</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -77,6 +120,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -104,7 +150,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxBasePoint"/>
<widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
@ -128,13 +178,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -335,6 +422,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Angle of line</string>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
@ -356,7 +446,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType"/>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
@ -406,7 +500,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of arcs</string>
@ -416,7 +510,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of curves</string>
@ -428,7 +522,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item>
</layout>
</item>
@ -451,6 +549,31 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>comboBoxBasePoint</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>doubleSpinBoxAngle</tabstop>
<tabstop>toolButtonArrowRight</tabstop>
<tabstop>toolButtonArrowRightUp</tabstop>
<tabstop>toolButtonArrowUp</tabstop>
<tabstop>toolButtonArrowLeftUp</tabstop>
<tabstop>toolButtonArrowLeft</tabstop>
<tabstop>toolButtonArrowLeftDown</tabstop>
<tabstop>toolButtonArrowDown</tabstop>
<tabstop>toolButtonArrowRightDown</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

101
dialogs/dialogheight.cpp Normal file
View File

@ -0,0 +1,101 @@
#include "dialogheight.h"
#include "ui_dialogheight.h"
DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()),
typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0){
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHeight::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected);
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxPoints(ui->comboBoxP1Line);
FillComboBoxPoints(ui->comboBoxP2Line);
FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
}
DialogHeight::~DialogHeight(){
delete ui;
}
void DialogHeight::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
void DialogHeight::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
void DialogHeight::setBasePointId(const qint64 &value, const qint64 &id){
basePointId = value;
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id);
}
void DialogHeight::setP1LineId(const qint64 &value, const qint64 &id){
p1LineId = value;
setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id);
}
void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id){
p2LineId = value;
setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id);
}
void DialogHeight::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
return;
}
}
if(mode == Draw::Modeling){
if(!CheckObject(id)){
return;
}
}
if(type == Scene::Point){
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
} else {
point = data->GetModelingPoint(id);
}
switch(number){
case(0):
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
number++;
emit ToolTip(tr("Select first point of line"));
break;
case(1):
ChangeCurrentText(ui->comboBoxP1Line, point.name());
number++;
emit ToolTip(tr("Select second point of line"));
break;
case(2):
ChangeCurrentText(ui->comboBoxP2Line, point.name());
number = 0;
emit ToolTip(tr(""));
if(!isInitialized){
this->show();
}
break;
}
}
}
void DialogHeight::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
basePointId = getCurrentPointId(ui->comboBoxBasePoint);
p1LineId = getCurrentPointId(ui->comboBoxP1Line);
p2LineId = getCurrentPointId(ui->comboBoxP2Line);
emit DialogClosed(QDialog::Accepted);
}

61
dialogs/dialogheight.h Normal file
View File

@ -0,0 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2013 Valentina project All Rights Reserved.
**
** This file is part of Valentina.
**
** Tox 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 DIALOGHEIGHT_H
#define DIALOGHEIGHT_H
#include "dialogtool.h"
namespace Ui {
class DialogHeight;
}
class DialogHeight : public DialogTool{
Q_OBJECT
public:
explicit DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogHeight();
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
inline qint64 getBasePointId() const {return basePointId;}
void setBasePointId(const qint64 &value, const qint64 &id);
inline qint64 getP1LineId() const {return p1LineId;}
void setP1LineId(const qint64 &value, const qint64 &id);
inline qint64 getP2LineId() const{return p2LineId;}
void setP2LineId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogHeight)
Ui::DialogHeight *ui;
qint32 number;
QString pointName;
QString typeLine;
qint64 basePointId;
qint64 p1LineId;
qint64 p2LineId;
};
#endif // DIALOGHEIGHT_H

214
dialogs/dialogheight.ui Normal file
View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogHeight</class>
<widget class="QDialog" name="DialogHeight">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>247</width>
<height>220</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Base point</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>First point of line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxP1Line">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Second point of line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxP2Line">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Type line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogHeight</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>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogHeight</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -147,14 +147,14 @@ QString DialogHistory::Record(const VToolRecord &tool){
case Tool::ArrowTool:
break;
case Tool::SinglePointTool:
record = QString("%1 - Базова точка").arg(data->GetPoint(tool.getId()).name());
record = QString(tr("%1 - Base point")).arg(data->GetPoint(tool.getId()).name());
break;
case Tool::EndLineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong();
}
record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(),
record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tool::LineTool:
@ -163,7 +163,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(),
record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name());
break;
case Tool::AlongLineTool:
@ -172,12 +172,12 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%3 - Точка на відрізку %1_%2").arg(data->GetPoint(basePointId).name(),
record = QString(tr("%3 - Point along line %1_%2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tool::ShoulderPointTool:
record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name());
record = QString(tr("%1 - Point of soulder")).arg(data->GetPoint(tool.getId()).name());
break;
case Tool::NormalTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
@ -185,7 +185,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%3 - Перпендикуляр до відрузку %1_%2").arg(data->GetPoint(basePointId).name(),
record = QString(tr("%3 - Normal to line %1_%2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
@ -196,7 +196,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("secondPoint", "").toLongLong();
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
}
record = QString("%4 - Бісектриса кута %1_%2_%3").arg(data->GetPoint(firstPointId).name(),
record = QString(tr("%4 - Bisector of angle %1_%2_%3")).arg(data->GetPoint(firstPointId).name(),
data->GetPoint(basePointId).name(),
data->GetPoint(thirdPointId).name(),
data->GetPoint(tool.getId()).name());
@ -209,7 +209,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
}
record = QString("%5 - Точка перетину відрузку %1_%2 і %3_%4").arg(data->GetPoint(p1Line1).name(),
record = QString(tr("%5 - Point of intersection lines %1_%2 and %3_%4")).arg(data->GetPoint(p1Line1).name(),
data->GetPoint(p2Line1).name(),
data->GetPoint(p1Line2).name(),
data->GetPoint(p2Line2).name(),
@ -217,20 +217,20 @@ QString DialogHistory::Record(const VToolRecord &tool){
break;
case Tool::SplineTool:{
VSpline spl = data->GetSpline(tool.getId());
record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(),
record = QString(tr("Curve %1_%2")).arg(data->GetPoint(spl.GetP1()).name(),
data->GetPoint(spl.GetP4()).name());
}
break;
case Tool::ArcTool:{
VArc arc = data->GetArc(tool.getId());
record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name());
record = QString(tr("Arc with center in point %1")).arg(data->GetPoint(arc.GetCenter()).name());
}
break;
case Tool::SplinePathTool:{
VSplinePath splPath = data->GetSplinePath(tool.getId());
QVector<VSplinePoint> points = splPath.GetSplinePath();
if(points.size() != 0 ){
record = QString("Шлях сплайну %1").arg(data->GetPoint(points[0].P()).name());
record = QString(tr("Curve point %1")).arg(data->GetPoint(points[0].P()).name());
for(qint32 i = 1; i< points.size(); ++i){
QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name());
record.append(name);
@ -245,13 +245,42 @@ QString DialogHistory::Record(const VToolRecord &tool){
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%4 - Точка дотику дуги з центром в точці %1 і відрізку %2_%3").arg(data->GetPoint(center).name(),
record = QString(tr("%4 - Point of contact arc with center in point %1 and line %2_%3")).arg(data->GetPoint(center).name(),
data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tool::Height:{
qint64 p1LineId = 0;
qint64 p2LineId = 0;
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong();
p1LineId = domElement.attribute("p1Line", "").toLongLong();
p2LineId = domElement.attribute("p2Line", "").toLongLong();
}
record = QString(tr("Point of perpendical from point %1 to line %2_%3")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(p1LineId).name(),
data->GetPoint(p2LineId).name());
break;
}
case Tool::Triangle:{
qint64 axisP1Id = 0;
qint64 axisP2Id = 0;
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
axisP1Id = domElement.attribute("axisP1", "").toLongLong();
axisP2Id = domElement.attribute("axisP2", "").toLongLong();
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(
data->GetPoint(axisP1Id).name(),data->GetPoint(axisP2Id).name(),
data->GetPoint(firstPointId).name(), data->GetPoint(secondPointId).name());
break;
}
default:
qWarning()<<"Get wrong tool type. Ignore.";
qWarning()<<tr("Get wrong tool type. Ignore.");
break;
}
return record;
@ -260,7 +289,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
void DialogHistory::InitialTable(){
ui->tableWidget->setSortingEnabled(false);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Інструмент"));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
}
void DialogHistory::ShowPoint(){
@ -275,7 +304,6 @@ void DialogHistory::ShowPoint(){
}
}
void DialogHistory::closeEvent(QCloseEvent *event){
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -29,12 +29,10 @@ namespace Ui {
class DialogHistory;
}
class DialogHistory : public DialogTool
{
class DialogHistory : public DialogTool{
Q_OBJECT
public:
explicit DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
virtual ~DialogHistory();
public slots:
virtual void DialogAccepted();

View File

@ -68,6 +68,10 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>tableWidget</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,17 +21,18 @@
#include "dialogincrements.h"
#include "ui_dialogincrements.h"
#include <QHeaderView>
#include <QCloseEvent>
#include "widgets/doubledelegate.h"
#include "container/vincrementtablerow.h"
#include <widgets/doubledelegate.h>
#include <exception/vexception.h>
DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) :
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc){
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc),
row(0), column(0){
ui->setupUi(this);
InitialStandartTable();
InitialIncrementTable();
InitialLinesTable();
InitialSplinesTable();
InitialArcsTable();
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);
@ -39,7 +40,10 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
FillStandartTable();
FillIncrementTable();
FillLengthLines();
FillLengthSplines();
FillLengthArcs();
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged);
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
connect(ui->toolButtonRemove, &QPushButton::clicked, this,
&DialogIncrements::clickedToolButtonRemove);
@ -51,12 +55,13 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogIncrements::DialogAccepted);
ui->tabWidget->setCurrentIndex(0);
}
void DialogIncrements::FillStandartTable(){
const QMap<QString, VStandartTableCell> *standartTable = data->DataStandartTable();
const QHash<QString, VStandartTableCell> *standartTable = data->DataStandartTable();
qint32 currentRow = -1;
QMapIterator<QString, VStandartTableCell> i(*standartTable);
QHashIterator<QString, VStandartTableCell> i(*standartTable);
ui->tableWidgetStandart->setRowCount ( standartTable->size() );
while (i.hasNext()) {
i.next();
@ -94,22 +99,31 @@ void DialogIncrements::FillStandartTable(){
}
void DialogIncrements::FillIncrementTable(){
const QMap<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable();
qint32 currentRow = -1;
QMapIterator<QString, VIncrementTableRow> i(*incrementTable);
const QHash<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable();
QHashIterator<QString, VIncrementTableRow> i(*incrementTable);
QMap<qint64, QString> map;
//Sorting QHash by id
while (i.hasNext()) {
i.next();
VIncrementTableRow cell = i.value();
map.insert(cell.getId(), i.key());
}
qint32 currentRow = -1;
QMapIterator<qint64, QString> iMap(map);
while (iMap.hasNext()) {
iMap.next();
VIncrementTableRow cell = incrementTable->value(iMap.value());
currentRow++;
ui->tableWidgetIncrement->setRowCount ( incrementTable->size() );
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
item->setTextAlignment(Qt::AlignHCenter);
item->setFont(QFont("Times", 12, QFont::Bold));
item->setData(Qt::UserRole, cell.getId());
ui->tableWidgetIncrement->setItem(currentRow, 0, item);
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(i.key())));
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
item->setTextAlignment(Qt::AlignHCenter);
// set the item non-editable (view only), and non-selectable
Qt::ItemFlags flags = item->flags();
@ -130,7 +144,7 @@ void DialogIncrements::FillIncrementTable(){
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
item = new QTableWidgetItem(cell.getDescription());
item->setTextAlignment(Qt::AlignHCenter);
item->setTextAlignment(Qt::AlignLeft);
ui->tableWidgetIncrement->setItem(currentRow, 5, item);
}
if(ui->tableWidgetIncrement->rowCount()>0){
@ -138,13 +152,21 @@ void DialogIncrements::FillIncrementTable(){
}
ui->tableWidgetIncrement->resizeColumnsToContents();
ui->tableWidgetIncrement->resizeRowsToContents();
ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20);
ui->tableWidgetIncrement->setCurrentCell( row, column );
}
void DialogIncrements::FillLengthLines(){
const QMap<QString, qreal> *linesTable = data->DataLengthLines();
const QHash<QString, qreal> *linesTable = data->DataLengthLines();
QHashIterator<QString, qreal> iHash(*linesTable);
QMap<QString, qreal> map;
//Sorting QHash by name
while (iHash.hasNext()) {
iHash.next();
map.insert(iHash.key(), iHash.value());
}
qint32 currentRow = -1;
QMapIterator<QString, qreal> i(*linesTable);
QMapIterator<QString, qreal> i(map);
while (i.hasNext()) {
i.next();
qreal length = i.value();
@ -166,9 +188,17 @@ void DialogIncrements::FillLengthLines(){
}
void DialogIncrements::FillLengthSplines(){
const QMap<QString, qreal> *splinesTable = data->DataLengthSplines();
const QHash<QString, qreal> *splinesTable = data->DataLengthSplines();
QHashIterator<QString, qreal> iHash(*splinesTable);
QMap<QString, qreal> map;
//Sorting QHash by name
while (iHash.hasNext()) {
iHash.next();
map.insert(iHash.key(), iHash.value());
}
qint32 currentRow = -1;
QMapIterator<QString, qreal> i(*splinesTable);
QMapIterator<QString, qreal> i(map);
while (i.hasNext()) {
i.next();
qreal length = i.value();
@ -176,7 +206,7 @@ void DialogIncrements::FillLengthSplines(){
ui->tableWidgetSplines->setRowCount ( splinesTable->size() );
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
item->setTextAlignment(Qt::AlignHCenter);
item->setTextAlignment(Qt::AlignLeft);
item->setFont(QFont("Times", 12, QFont::Bold));
ui->tableWidgetSplines->setItem(currentRow, 0, item);
@ -190,9 +220,17 @@ void DialogIncrements::FillLengthSplines(){
}
void DialogIncrements::FillLengthArcs(){
const QMap<QString, qreal> *arcsTable = data->DataLengthArcs();
const QHash<QString, qreal> *arcsTable = data->DataLengthArcs();
QHashIterator<QString, qreal> iHash(*arcsTable);
QMap<QString, qreal> map;
//Sorting QHash by name
while (iHash.hasNext()) {
iHash.next();
map.insert(iHash.key(), iHash.value());
}
qint32 currentRow = -1;
QMapIterator<QString, qreal> i(*arcsTable);
QMapIterator<QString, qreal> i(map);
while (i.hasNext()) {
i.next();
qreal length = i.value();
@ -251,15 +289,15 @@ void DialogIncrements::clickedToolButtonAdd(){
qint32 num = 1;
QString name;
do{
name = QString("Позначення %1").arg(num);
name = QString(tr("Denotation %1")).arg(num);
num++;
}while(data->IncrementTableContains(name));
qint64 id = data->getNextId();
qint32 base = 0;
qreal base = 0;
qreal ksize = 0;
qreal kgrowth = 0;
QString description = QString("Опис");
QString description = QString(tr("Description"));
VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description);
data->AddIncrementTableRow(name, incrementRow);
@ -292,13 +330,14 @@ void DialogIncrements::clickedToolButtonAdd(){
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
item = new QTableWidgetItem("Опис");
item = new QTableWidgetItem(tr("Description"));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 5, item);
ui->toolButtonRemove->setEnabled(true);
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged);
emit haveLiteChange();
}
void DialogIncrements::clickedToolButtonRemove(){
@ -320,9 +359,10 @@ void DialogIncrements::clickedToolButtonRemove(){
}
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged);
emit haveLiteChange();
}
void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize,
void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize,
qreal kgrowth, QString description){
QDomNodeList list = doc->elementsByTagName("increments");
QDomElement element = doc->createElement("increment");
@ -355,10 +395,11 @@ void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qint32 base,
}
void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
QTableWidgetItem *item;
QTableWidgetItem *itemName;
QTableWidgetItem *item = 0;
QTableWidgetItem *itemName = 0;
qint64 id;
QDomElement domElement;
this->row = row;
switch(column) {
case 0:
item = ui->tableWidgetIncrement->item(row, 0);
@ -367,6 +408,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
if(domElement.isElement()){
domElement.setAttribute("name", item->text());
data->ClearIncrementTable();
this->column = 2;
emit FullUpdateTree();
}
break;
@ -376,8 +418,15 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
id = qvariant_cast<qint64>(itemName->data(Qt::UserRole));
domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
domElement.setAttribute("base", item->text().toDouble());
bool ok = false;
qreal value = item->text().toDouble(&ok);
if(ok){
domElement.setAttribute("base", value);
this->column = 3;
emit FullUpdateTree();
} else {
throw VException(tr("Can't convert toDouble value."));
}
}
break;
case 3:
@ -387,6 +436,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
domElement.setAttribute("ksize", item->text().toDouble());
this->column = 4;
emit FullUpdateTree();
}
break;
@ -397,6 +447,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
domElement.setAttribute("kgrowth", item->text().toDouble());
this->column = 5;
emit FullUpdateTree();
}
break;
@ -410,6 +461,9 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text());
incr.setDescription(item->text());
data->UpdateIncrementTableRow(itemName->text(), incr);
ui->tableWidgetIncrement->resizeColumnsToContents();
ui->tableWidgetIncrement->resizeRowsToContents();
ui->tableWidgetIncrement->setCurrentCell( row, 0 );
emit haveLiteChange();
}
break;
@ -418,37 +472,38 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
void DialogIncrements::InitialStandartTable(){
ui->tableWidgetStandart->setSortingEnabled(false);
ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення"));
ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач."));
ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач."));
ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі"));
ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості"));
ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис"));
ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation")));
ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value")));
ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value")));
ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size")));
ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth")));
ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description")));
}
void DialogIncrements::InitialIncrementTable(){
ui->tableWidgetIncrement->setSortingEnabled(false);
ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення"));
ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач."));
ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач."));
ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі"));
ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості"));
ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис"));
ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description")));
ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20);
}
void DialogIncrements::InitialLinesTable(){
ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія"));
ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина"));
ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Line")));
ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
}
void DialogIncrements::InitialSplinesTable(){
ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія"));
ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина"));
ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Curve")));
ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
}
void DialogIncrements::InitialArcsTable(){
ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія"));
ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина"));
ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Arc")));
ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
}
void DialogIncrements::DialogAccepted(){

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -29,11 +29,10 @@ namespace Ui {
class DialogIncrements;
}
class DialogIncrements : public DialogTool
{
class DialogIncrements : public DialogTool{
Q_OBJECT
public:
explicit DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
~DialogIncrements();
public slots:
void clickedToolButtonAdd();
@ -49,6 +48,8 @@ private:
Ui::DialogIncrements *ui;
VContainer *data; // need because we must change data
VDomDocument *doc;
qint32 row;
qint32 column;
void InitialStandartTable();
void InitialIncrementTable();
void InitialLinesTable();
@ -59,7 +60,7 @@ private:
void FillLengthLines();
void FillLengthSplines();
void FillLengthArcs();
void AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth,
void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth,
QString description);
};

View File

@ -27,7 +27,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabStandart">
<attribute name="title">
@ -149,9 +149,15 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>45</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Denotation</string>
@ -338,6 +344,17 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>tableWidgetStandart</tabstop>
<tabstop>tableWidgetIncrement</tabstop>
<tabstop>toolButtonAdd</tabstop>
<tabstop>toolButtonRemove</tabstop>
<tabstop>tableWidgetLines</tabstop>
<tabstop>tableWidgetSplines</tabstop>
<tabstop>tableWidgetArcs</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,8 +21,6 @@
#include "dialogline.h"
#include "ui_dialogline.h"
#include <QPushButton>
#include <QCloseEvent>
DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){
@ -40,10 +38,6 @@ DialogLine::~DialogLine(){
delete ui;
}
qint64 DialogLine::getSecondPoint() const{
return secondPoint;
}
void DialogLine::setSecondPoint(const qint64 &value){
secondPoint = value;
VPointF point = data->GetPoint(value);
@ -53,10 +47,6 @@ void DialogLine::setSecondPoint(const qint64 &value){
}
}
qint64 DialogLine::getFirstPoint() const{
return firstPoint;
}
void DialogLine::setFirstPoint(const qint64 &value){
firstPoint = value;
VPointF point = data->GetPoint(value);
@ -99,6 +89,7 @@ void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point"));
return;
}
}
@ -107,6 +98,7 @@ void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -28,16 +28,15 @@ namespace Ui {
class DialogLine;
}
class DialogLine : public DialogTool
{
class DialogLine : public DialogTool{
Q_OBJECT
public:
explicit DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogLine();
qint64 getFirstPoint() const;
inline qint64 getFirstPoint() const {return firstPoint;}
void setFirstPoint(const qint64 &value);
qint64 getSecondPoint() const;
inline qint64 getSecondPoint() const {return secondPoint;}
void setSecondPoint(const qint64 &value);
public slots:
void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -61,6 +61,11 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -29,6 +29,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod
number = 0;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted);
labelEditNamePoint = ui->labelEditNamePoint;
flagName = false;
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
@ -40,8 +41,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged);
}
DialogLineIntersect::~DialogLineIntersect()
{
DialogLineIntersect::~DialogLineIntersect(){
delete ui;
}
@ -70,6 +70,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP1Line1->setCurrentIndex(index);
p1Line1 = id;
number++;
emit ToolTip(tr("Select second point of first line"));
return;
}
}
@ -79,6 +80,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP2Line1->setCurrentIndex(index);
p2Line1 = id;
number++;
emit ToolTip(tr("Select first point of second line"));
return;
}
}
@ -88,6 +90,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP1Line2->setCurrentIndex(index);
p1Line2 = id;
number++;
emit ToolTip(tr("Select second point of second line"));
return;
}
}
@ -97,6 +100,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP2Line2->setCurrentIndex(index);
p2Line2 = id;
number = 0;
emit ToolTip("");
}
if(!isInitialized){
flagPoint = CheckIntersecion();
@ -153,7 +157,7 @@ void DialogLineIntersect::P2Line2Changed(int index){
}
void DialogLineIntersect::CheckState(){
Q_CHECK_PTR(bOk);
Q_ASSERT(bOk != 0);
bOk->setEnabled(flagName && flagPoint);
}
@ -174,46 +178,26 @@ bool DialogLineIntersect::CheckIntersecion(){
}
}
qint64 DialogLineIntersect::getP2Line2() const{
return p2Line2;
}
void DialogLineIntersect::setP2Line2(const qint64 &value){
p2Line2 = value;
ChangeCurrentData(ui->comboBoxP2Line2, value);
}
qint64 DialogLineIntersect::getP1Line2() const{
return p1Line2;
}
void DialogLineIntersect::setP1Line2(const qint64 &value){
p1Line2 = value;
ChangeCurrentData(ui->comboBoxP1Line2, value);
}
qint64 DialogLineIntersect::getP2Line1() const{
return p2Line1;
}
void DialogLineIntersect::setP2Line1(const qint64 &value){
p2Line1 = value;
ChangeCurrentData(ui->comboBoxP2Line1, value);
}
qint64 DialogLineIntersect::getP1Line1() const{
return p1Line1;
}
void DialogLineIntersect::setP1Line1(const qint64 &value){
p1Line1 = value;
ChangeCurrentData(ui->comboBoxP1Line1, value);
}
QString DialogLineIntersect::getPointName() const{
return pointName;
}
void DialogLineIntersect::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -28,22 +28,21 @@ namespace Ui {
class DialogLineIntersect;
}
class DialogLineIntersect : public DialogTool
{
class DialogLineIntersect : public DialogTool{
Q_OBJECT
public:
explicit DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogLineIntersect();
qint64 getP1Line1() const;
inline qint64 getP1Line1() const {return p1Line1;}
void setP1Line1(const qint64 &value);
qint64 getP2Line1() const;
inline qint64 getP2Line1() const {return p2Line1;}
void setP2Line1(const qint64 &value);
qint64 getP1Line2() const;
inline qint64 getP1Line2() const {return p1Line2;}
void setP1Line2(const qint64 &value);
qint64 getP2Line2() const;
inline qint64 getP2Line2() const {return p2Line2;}
void setP2Line2(const qint64 &value);
QString getPointName() const;
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -127,6 +164,14 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxP1Line1</tabstop>
<tabstop>comboBoxP2Line1</tabstop>
<tabstop>comboBoxP1Line2</tabstop>
<tabstop>comboBoxP2Line2</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,7 +21,6 @@
#include "dialognormal.h"
#include "ui_dialognormal.h"
#include <QMenu>
DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
@ -35,7 +34,11 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted);
@ -72,13 +75,14 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogNormal::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogNormal::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogNormal::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogNormal::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged);
}
DialogNormal::~DialogNormal()
{
DialogNormal::~DialogNormal(){
delete ui;
}
@ -106,6 +110,7 @@ void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point of line"));
return;
}
}
@ -114,6 +119,7 @@ void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
@ -132,53 +138,29 @@ void DialogNormal::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
qint64 DialogNormal::getSecondPointId() const{
return secondPointId;
}
void DialogNormal::setSecondPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
qint64 DialogNormal::getFirstPointId() const{
return firstPointId;
}
void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
qreal DialogNormal::getAngle() const{
return angle;
}
void DialogNormal::setAngle(const qreal &value){
angle = value;
ui->doubleSpinBoxAngle->setValue(angle);
}
QString DialogNormal::getFormula() const{
return formula;
}
void DialogNormal::setFormula(const QString &value){
formula = value;
ui->lineEditFormula->setText(formula);
}
QString DialogNormal::getTypeLine() const{
return typeLine;
}
void DialogNormal::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
QString DialogNormal::getPointName() const{
return pointName;
}
void DialogNormal::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,31 +23,28 @@
#define DIALOGNORMAL_H
#include "dialogtool.h"
#include <QListWidgetItem>
#include "container/calculator.h"
namespace Ui {
class DialogNormal;
}
class DialogNormal : public DialogTool
{
class DialogNormal : public DialogTool{
Q_OBJECT
public:
explicit DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogNormal();
QString getPointName() const;
inline QString getPointName() const{return pointName;}
void setPointName(const QString &value);
QString getTypeLine() const;
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
QString getFormula() const;
inline QString getFormula() const {return formula;}
void setFormula(const QString &value);
qreal getAngle() const;
inline qreal getAngle() const {return angle;}
void setAngle(const qreal &value);
qint64 getFirstPointId() const;
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const;
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length</string>
</property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Formula calculation of length of normal</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -77,6 +120,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -91,13 +137,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -108,6 +191,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -379,7 +465,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType"/>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
@ -429,7 +519,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of arcs</string>
@ -439,7 +529,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of curves</string>
@ -451,7 +541,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item>
</layout>
</item>
@ -474,6 +568,32 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>doubleSpinBoxAngle</tabstop>
<tabstop>toolButtonArrowRight</tabstop>
<tabstop>toolButtonArrowRightUp</tabstop>
<tabstop>toolButtonArrowUp</tabstop>
<tabstop>toolButtonArrowLeftUp</tabstop>
<tabstop>toolButtonArrowLeft</tabstop>
<tabstop>toolButtonArrowLeftDown</tabstop>
<tabstop>toolButtonArrowDown</tabstop>
<tabstop>toolButtonArrowRightDown</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -32,7 +32,11 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
radioButtonStandartTable = ui.radioButtonStandartTable;
radioButtonIncrements = ui.radioButtonIncrements;
radioButtonLengthLine = ui.radioButtonLengthLine;
radioButtonLengthArc = ui.radioButtonLengthArc;
radioButtonLengthCurve = ui.radioButtonLengthSpline;
lineEditFormula = ui.lineEditFormula;
labelEditFormula = ui.labelEditFormula;
labelEditNamePoint = ui.labelEditNamePoint;
flagFormula = false;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted);
@ -53,6 +57,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
connect(ui.radioButtonStandartTable, &QRadioButton::clicked, this, &DialogPointOfContact::StandartTable);
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);
@ -82,6 +88,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui.comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point of line"));
return;
}
}
@ -90,6 +97,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui.comboBoxSecondPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select point of center of arc"));
return;
}
}
@ -98,6 +106,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui.comboBoxCenter->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
@ -106,7 +115,6 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
}
}
void DialogPointOfContact::DialogAccepted(){
pointName = ui.lineEditNamePoint->text();
radius = ui.lineEditFormula->text();
@ -116,44 +124,24 @@ void DialogPointOfContact::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
qint64 DialogPointOfContact::getSecondPoint() const{
return secondPoint;
}
void DialogPointOfContact::setSecondPoint(const qint64 &value, const qint64 &id){
setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id);
}
qint64 DialogPointOfContact::getFirstPoint() const{
return firstPoint;
}
void DialogPointOfContact::setFirstPoint(const qint64 &value, const qint64 &id){
setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id);
}
qint64 DialogPointOfContact::getCenter() const{
return center;
}
void DialogPointOfContact::setCenter(const qint64 &value, const qint64 &id){
setCurrentPointId(ui.comboBoxCenter, center, value, id);
center = value;
}
QString DialogPointOfContact::getRadius() const{
return radius;
}
void DialogPointOfContact::setRadius(const QString &value){
radius = value;
ui.lineEditFormula->setText(radius);
}
QString DialogPointOfContact::getPointName() const{
return pointName;
}
void DialogPointOfContact::setPointName(const QString &value){
pointName = value;
ui.lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -24,30 +24,23 @@
#include "ui_dialogpointofcontact.h"
#include "dialogtool.h"
#include "container/calculator.h"
class DialogPointOfContact : public DialogTool
{
class DialogPointOfContact : public DialogTool{
Q_OBJECT
public:
explicit DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation,
DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
QString getPointName() const;
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
QString getRadius() const;
inline QString getRadius() const {return radius;}
void setRadius(const QString &value);
qint64 getCenter() const;
inline qint64 getCenter() const {return center;}
void setCenter(const qint64 &value, const qint64 &id);
qint64 getFirstPoint() const;
inline qint64 getFirstPoint() const {return firstPoint;}
void setFirstPoint(const qint64 &value, const qint64 &id);
qint64 getSecondPoint() const;
inline qint64 getSecondPoint() const {return secondPoint;}
void setSecondPoint(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();

View File

@ -24,13 +24,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Radius</string>
</property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Formula calculation of radius of arc</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -77,6 +120,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of radius</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -91,13 +137,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -108,6 +191,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -154,6 +240,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Slect point of center of arc</string>
</property>
</widget>
</item>
</layout>
@ -270,7 +359,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of arcs</string>
@ -280,7 +369,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of curves</string>
@ -292,7 +381,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item>
</layout>
</item>
@ -315,6 +408,23 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxCenter</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -0,0 +1,86 @@
#include "dialogpointofintersection.h"
#include "ui_dialogpointofintersection.h"
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
firstPointId(0), secondPointId(0){
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
}
DialogPointOfIntersection::~DialogPointOfIntersection(){
delete ui;
}
void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint64 &id){
secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
void DialogPointOfIntersection::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
return;
}
}
if(mode == Draw::Modeling){
if(!CheckObject(id)){
return;
}
}
if(type == Scene::Point){
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
} else {
point = data->GetModelingPoint(id);
}
if(number == 0){
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select point horizontally"));
return;
}
}
if(number == 1){
qint32 index = ui->comboBoxSecondPoint->findText(point.name());
if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
}
}
}
}
void DialogPointOfIntersection::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
emit DialogClosed(QDialog::Accepted);
}
void DialogPointOfIntersection::setFirstPointId(const qint64 &value, const qint64 &id){
firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
void DialogPointOfIntersection::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}

View File

@ -0,0 +1,34 @@
#ifndef DIALOGPOINTOFINTERSECTION_H
#define DIALOGPOINTOFINTERSECTION_H
#include "dialogtool.h"
namespace Ui {
class DialogPointOfIntersection;
}
class DialogPointOfIntersection : public DialogTool{
Q_OBJECT
public:
DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogPointOfIntersection();
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogPointOfIntersection)
Ui::DialogPointOfIntersection *ui;
qint32 number;
QString pointName;
qint64 firstPointId;
qint64 secondPointId;
};
#endif // DIALOGPOINTOFINTERSECTION_H

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPointOfIntersection</class>
<widget class="QDialog" name="DialogPointOfIntersection">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>293</width>
<height>180</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point vertically</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point horizontally</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>Second point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogPointOfIntersection</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>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogPointOfIntersection</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -37,5 +37,6 @@
#include "dialogsinglepoint.h"
#include "dialogspline.h"
#include "dialogsplinepath.h"
#include "dialogheight.h"
#endif // DIALOGS_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -34,7 +34,11 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted);
@ -56,13 +60,14 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged);
}
DialogShoulderPoint::~DialogShoulderPoint()
{
DialogShoulderPoint::~DialogShoulderPoint(){
delete ui;
}
@ -90,6 +95,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxP1Line->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point of line"));
return;
}
}
@ -98,6 +104,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxP2Line->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select point of shoulder"));
return;
}
}
@ -106,6 +113,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxPShoulder->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
@ -124,52 +132,28 @@ void DialogShoulderPoint::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
qint64 DialogShoulderPoint::getPShoulder() const{
return pShoulder;
}
void DialogShoulderPoint::setPShoulder(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id);
}
qint64 DialogShoulderPoint::getP2Line() const{
return p2Line;
}
void DialogShoulderPoint::setP2Line(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id);
}
qint64 DialogShoulderPoint::getP1Line() const{
return p1Line;
}
void DialogShoulderPoint::setP1Line(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id);
}
QString DialogShoulderPoint::getFormula() const{
return formula;
}
void DialogShoulderPoint::setFormula(const QString &value){
formula = value;
ui->lineEditFormula->setText(formula);
}
QString DialogShoulderPoint::getTypeLine() const{
return typeLine;
}
void DialogShoulderPoint::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
QString DialogShoulderPoint::getPointName() const{
return pointName;
}
void DialogShoulderPoint::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,30 +23,28 @@
#define DIALOGSHOULDERPOINT_H
#include "dialogtool.h"
#include "container/calculator.h"
namespace Ui {
class DialogShoulderPoint;
}
class DialogShoulderPoint : public DialogTool
{
class DialogShoulderPoint : public DialogTool{
Q_OBJECT
public:
explicit DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation,
DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogShoulderPoint();
QString getPointName() const;
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
QString getTypeLine() const;
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
QString getFormula() const;
inline QString getFormula() const {return formula;}
void setFormula(const QString &value);
qint64 getP1Line() const;
inline qint64 getP1Line() const {return p1Line;}
void setP1Line(const qint64 &value, const qint64 &id);
qint64 getP2Line() const;
inline qint64 getP2Line() const {return p2Line;}
void setP2Line(const qint64 &value, const qint64 &id);
qint64 getPShoulder() const;
inline qint64 getPShoulder() const {return pShoulder;}
void setPShoulder(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length</string>
</property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Formula calculation of length of line</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -77,6 +120,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text">
<string>_</string>
</property>
@ -91,13 +137,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
@ -108,6 +191,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text">
<string>...</string>
</property>
@ -240,7 +326,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType"/>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
@ -290,7 +380,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of lines</string>
@ -300,7 +390,7 @@
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Length of curves</string>
@ -312,7 +402,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item>
</layout>
</item>
@ -335,6 +429,24 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxP1Line</tabstop>
<tabstop>comboBoxP2Line</tabstop>
<tabstop>comboBoxPShoulder</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,18 +21,15 @@
#include "dialogsinglepoint.h"
#include "ui_dialogsinglepoint.h"
#include <QShowEvent>
#include <QPushButton>
#include <QDebug>
#include "options.h"
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) :
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()),
point(QPointF()){
ui->setupUi(this);
ui->doubleSpinBoxX->setRange(0,PaperSize/PrintDPI*25.4);
ui->doubleSpinBoxY->setRange(0,PaperSize/PrintDPI*25.4);
ui->doubleSpinBoxX->setRange(0,toMM(PaperSize));
ui->doubleSpinBoxY->setRange(0,toMM(PaperSize));
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
labelEditNamePoint = ui->labelEditName;
flagName = false;
CheckState();
connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted);
@ -43,18 +40,17 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) :
void DialogSinglePoint::mousePress(QPointF scenePos){
if(isInitialized == false){
ui->doubleSpinBoxX->setValue(scenePos.x()/PrintDPI*25.4);
ui->doubleSpinBoxY->setValue(scenePos.y()/PrintDPI*25.4);
ui->doubleSpinBoxX->setValue(toMM(scenePos.x()));
ui->doubleSpinBoxY->setValue(toMM(scenePos.y()));
this->show();
} else {
ui->doubleSpinBoxX->setValue(scenePos.x()/PrintDPI*25.4);
ui->doubleSpinBoxY->setValue(scenePos.y()/PrintDPI*25.4);
ui->doubleSpinBoxX->setValue(toMM(scenePos.x()));
ui->doubleSpinBoxY->setValue(toMM(scenePos.y()));
}
}
void DialogSinglePoint::DialogAccepted(){
point = QPointF(ui->doubleSpinBoxX->value()*PrintDPI/25.4,
ui->doubleSpinBoxY->value()*PrintDPI/25.4);
point = QPointF(toPixel(ui->doubleSpinBoxX->value()), toPixel(ui->doubleSpinBoxY->value()));
name = ui->lineEditName->text();
emit DialogClosed(QDialog::Accepted);
}
@ -64,16 +60,8 @@ void DialogSinglePoint::setData(const QString name, const QPointF point){
this->point = point;
isInitialized = true;
ui->lineEditName->setText(name);
ui->doubleSpinBoxX->setValue(point.x()/PrintDPI*25.4);
ui->doubleSpinBoxY->setValue(point.y()/PrintDPI*25.4);
}
QString DialogSinglePoint::getName()const{
return name;
}
QPointF DialogSinglePoint::getPoint()const{
return point;
ui->doubleSpinBoxX->setValue(toMM(point.x()));
ui->doubleSpinBoxY->setValue(toMM(point.y()));
}
DialogSinglePoint::~DialogSinglePoint(){

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -28,14 +28,13 @@ namespace Ui {
class DialogSinglePoint;
}
class DialogSinglePoint : public DialogTool
{
class DialogSinglePoint : public DialogTool{
Q_OBJECT
public:
explicit DialogSinglePoint(const VContainer *data, QWidget *parent = 0);
DialogSinglePoint(const VContainer *data, QWidget *parent = 0);
void setData(const QString name, const QPointF point);
QString getName()const;
QPointF getPoint()const;
inline QString getName()const {return name;}
inline QPointF getPoint()const {return point;}
~DialogSinglePoint();
public slots:
void mousePress(QPointF scenePos);

View File

@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>249</width>
<width>250</width>
<height>202</height>
</rect>
</property>
@ -35,8 +35,11 @@
<height>129</height>
</rect>
</property>
<property name="toolTip">
<string>Coordinates on the sheet</string>
</property>
<property name="title">
<string>Координати</string>
<string>Coordinates</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
@ -61,15 +64,52 @@
</item>
</layout>
</widget>
<widget class="QLabel" name="labelName">
<widget class="QLabel" name="labelEditName">
<property name="geometry">
<rect>
<x>170</x>
<y>10</y>
<width>72</width>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Point name</string>
</property>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -67,6 +67,7 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxP1->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select last point of curve"));
return;
}
}
@ -75,6 +76,7 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found
ui->comboBoxP4->setCurrentIndex(index);
number = 0;
emit ToolTip("");
index = ui->comboBoxP1->currentIndex();
qint64 p1Id = qvariant_cast<qint64>(ui->comboBoxP1->itemData(index));
QPointF p1;
@ -107,64 +109,36 @@ void DialogSpline::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
qreal DialogSpline::getKCurve() const{
return kCurve;
}
void DialogSpline::setKCurve(const qreal &value){
kCurve = value;
ui->doubleSpinBoxKcurve->setValue(value);
}
qreal DialogSpline::getKAsm2() const{
return kAsm2;
}
void DialogSpline::setKAsm2(const qreal &value){
kAsm2 = value;
ui->doubleSpinBoxKasm2->setValue(value);
}
qreal DialogSpline::getKAsm1() const{
return kAsm1;
}
void DialogSpline::setKAsm1(const qreal &value){
kAsm1 = value;
ui->doubleSpinBoxKasm1->setValue(value);
}
qreal DialogSpline::getAngle2() const{
return angle2;
}
void DialogSpline::setAngle2(const qreal &value){
angle2 = value;
ui->spinBoxAngle2->setValue(static_cast<qint32>(value));
}
qreal DialogSpline::getAngle1() const{
return angle1;
}
void DialogSpline::setAngle1(const qreal &value){
angle1 = value;
ui->spinBoxAngle1->setValue(static_cast<qint32>(value));
}
qint64 DialogSpline::getP4() const{
return p4;
}
void DialogSpline::setP4(const qint64 &value){
p4 = value;
ChangeCurrentData(ui->comboBoxP4, value);
}
qint64 DialogSpline::getP1() const{
return p1;
}
void DialogSpline::setP1(const qint64 &value){
p1 = value;
ChangeCurrentData(ui->comboBoxP1, value);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -28,26 +28,25 @@ namespace Ui {
class DialogSpline;
}
class DialogSpline : public DialogTool
{
class DialogSpline : public DialogTool{
Q_OBJECT
public:
explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogSpline();
qint64 getP1() const;
inline qint64 getP1() const {return p1;}
void setP1(const qint64 &value);
qint64 getP4() const;
inline qint64 getP4() const {return p4;}
void setP4(const qint64 &value);
qreal getAngle1() const;
inline qreal getAngle1() const {return angle1;}
void setAngle1(const qreal &value);
qreal getAngle2() const;
inline qreal getAngle2() const {return angle2;}
void setAngle2(const qreal &value);
qreal getKAsm1() const;
inline qreal getKAsm1() const {return kAsm1;}
void setKAsm1(const qreal &value);
qreal getKAsm2() const;
inline qreal getKAsm2() const {return kAsm2;}
void setKAsm2(const qreal &value);
qreal getKCurve() const;
inline qreal getKCurve() const {return kCurve;}
void setKCurve(const qreal &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -199,6 +199,16 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>comboBoxP1</tabstop>
<tabstop>comboBoxP4</tabstop>
<tabstop>doubleSpinBoxKasm1</tabstop>
<tabstop>doubleSpinBoxKasm2</tabstop>
<tabstop>spinBoxAngle1</tabstop>
<tabstop>spinBoxAngle2</tabstop>
<tabstop>doubleSpinBoxKcurve</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -48,15 +48,10 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWi
this, &DialogSplinePath::KAsm2Changed);
}
DialogSplinePath::~DialogSplinePath()
{
DialogSplinePath::~DialogSplinePath(){
delete ui;
}
VSplinePath DialogSplinePath::GetPath() const{
return path;
}
void DialogSplinePath::SetPath(const VSplinePath &value){
this->path = value;
ui->listWidget->clear();
@ -82,6 +77,7 @@ void DialogSplinePath::ChoosedObject(qint64 id, Scene::Scenes type){
}
if(type == Scene::Point){
NewItem(id, 1, 0, 1);
emit ToolTip(tr("Select point of curve path"));
this->show();
}
}
@ -93,6 +89,7 @@ void DialogSplinePath::DialogAccepted(){
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
}
path.setKCurve(ui->doubleSpinBoxKcurve->value());
emit ToolTip("");
emit DialogClosed(QDialog::Accepted);
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -29,14 +29,13 @@ namespace Ui {
class DialogSplinePath;
}
class DialogSplinePath : public DialogTool
{
class DialogSplinePath : public DialogTool{
Q_OBJECT
public:
explicit DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation,
DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogSplinePath();
VSplinePath GetPath() const;
inline VSplinePath GetPath() const {return path;}
void SetPath(const VSplinePath &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -126,7 +126,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>List of points</string>
</property>
</widget>
</item>
</layout>
</item>
@ -184,6 +188,16 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>comboBoxPoint</tabstop>
<tabstop>doubleSpinBoxKasm1</tabstop>
<tabstop>spinBoxAngle1</tabstop>
<tabstop>doubleSpinBoxKasm2</tabstop>
<tabstop>spinBoxAngle2</tabstop>
<tabstop>doubleSpinBoxKcurve</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../icon.qrc"/>
</resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,25 +20,18 @@
****************************************************************************/
#include "dialogtool.h"
#include <QListWidgetItem>
#include <QCloseEvent>
#include "container/calculator.h"
#include "geometry/vdetail.h"
#include <QDebug>
#include <container/calculator.h>
DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data),
isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0),
lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0),
radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0),
radioButtonLengthLine(0), idDetail(0), mode(mode){
Q_CHECK_PTR(data);
lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0),
labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0),
radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), idDetail(0), mode(mode){
Q_ASSERT(data != 0);
timerFormula = new QTimer(this);
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
}
DialogTool::~DialogTool(){
}
void DialogTool::closeEvent(QCloseEvent *event){
DialogClosed(QDialog::Rejected);
event->accept();
@ -52,14 +45,14 @@ void DialogTool::showEvent(QShowEvent *event){
if(isInitialized){
return;
}
isInitialized = true;//перший показ вікна вже відбувся
isInitialized = true;//first show windows are held
}
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
box->clear();
if(mode == Draw::Calculation){
const QMap<qint64, VPointF> *points = data->DataPoints();
QMapIterator<qint64, VPointF> i(*points);
const QHash<qint64, VPointF> *points = data->DataPoints();
QHashIterator<qint64, VPointF> i(*points);
while (i.hasNext()) {
i.next();
if(i.key() != id){
@ -69,7 +62,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
}
} else {
if(idDetail <= 0){
qWarning()<<"Wrong details id."<<Q_FUNC_INFO;
qWarning()<<tr("Wrong details id.")<<Q_FUNC_INFO;
return;
}
VDetail det = data->GetDetail(idDetail);
@ -92,13 +85,14 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
}
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{
Q_ASSERT(box != 0);
QStringList list;
list<<"Лінія"<<"Без лінії";
list<<tr("Line")<<tr("No line");
box->addItems(list);
}
QString DialogTool::GetTypeLine(const QComboBox *box) const{
if(box->currentText()=="Лінія"){
if(box->currentText()==tr("Line")){
return QString("hair");
} else {
return QString("none");
@ -107,13 +101,13 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const{
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){
if(value == "hair"){
qint32 index = box->findText("Лінія");
qint32 index = box->findText(tr("Line"));
if(index != -1){
box->setCurrentIndex(index);
}
}
if(value == "none"){
qint32 index = box->findText("Без лінії");
qint32 index = box->findText(tr("No line"));
if(index != -1){
box->setCurrentIndex(index);
}
@ -124,6 +118,8 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value){
qint32 index = box->findText(value);
if(index != -1){
box->setCurrentIndex(index);
} else {
qWarning()<<tr("Can't find point by name")<<value;
}
}
@ -135,56 +131,68 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const{
}
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){
Q_CHECK_PTR(lineEdit);
Q_CHECK_PTR(listWidget);
Q_ASSERT(lineEdit != 0);
Q_ASSERT(listWidget != 0);
QListWidgetItem *item = listWidget->currentItem();
QString val = item->text();
lineEdit->setText(lineEdit->text().append(val));
int pos = lineEdit->cursorPosition();
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
lineEdit->setFocus();
lineEdit->setCursorPosition(pos + item->text().size());
}
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_ASSERT(edit != 0);
Q_ASSERT(timer != 0);
Q_ASSERT(labelEditFormula != 0);
if(edit->text().isEmpty()){
flag = false;
CheckState();
QPalette palette = labelEditFormula->palette();
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
labelEditFormula->setPalette(palette);
return;
}
timer->start(1000);
}
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label){
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(label);
Q_ASSERT(edit != 0);
Q_ASSERT(timer != 0);
Q_ASSERT(label != 0);
Q_ASSERT(labelEditFormula != 0);
QPalette palette = labelEditFormula->palette();
if(edit->text().isEmpty()){
flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
} else {
Calculator cal(data);
QString errorMsg;
qreal result = cal.eval(edit->text(),&errorMsg);
if(!errorMsg.isEmpty()){
label->setText("Помилка.");
label->setText(tr("Error"));
flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
} else {
label->setText(QString().setNum(result));
flag = true;
palette.setColor(labelEditFormula->foregroundRole(), QColor(76,76,76));
}
}
CheckState();
timer->stop();
labelEditFormula->setPalette(palette);
}
void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value,
const qint64 &id) const{
Q_CHECK_PTR(box);
Q_ASSERT(box != 0);
FillComboBoxPoints(box, id);
pointId = value;
ChangeCurrentData(box, value);
}
qint64 DialogTool::getCurrentPointId(QComboBox *box) const{
Q_CHECK_PTR(box);
Q_ASSERT(box != 0);
qint32 index = box->currentIndex();
Q_ASSERT(index != -1);
if(index != -1){
@ -195,24 +203,30 @@ qint64 DialogTool::getCurrentPointId(QComboBox *box) const{
}
void DialogTool::CheckState(){
Q_CHECK_PTR(bOk);
Q_ASSERT(bOk != 0);
bOk->setEnabled(flagFormula && flagName);
}
void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){
Q_UNUSED(id);
Q_UNUSED(type);
}
void DialogTool::NamePointChanged(){
Q_ASSERT(labelEditNamePoint != 0);
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if (edit){
QString name = edit->text();
if(name.isEmpty() || name.contains(" ")){
flagName = false;
QPalette palette = labelEditNamePoint->palette();
palette.setColor(labelEditNamePoint->foregroundRole(), Qt::red);
labelEditNamePoint->setPalette(palette);
} else {
flagName = true;
QPalette palette = labelEditNamePoint->palette();
palette.setColor(labelEditNamePoint->foregroundRole(), QColor(76,76,76));
labelEditNamePoint->setPalette(palette);
}
}
CheckState();
@ -234,48 +248,48 @@ void DialogTool::FormulaChanged(){
}
void DialogTool::ArrowUp(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(90);
}
void DialogTool::ArrowDown(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(270);
}
void DialogTool::ArrowLeft(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(180);
}
void DialogTool::ArrowRight(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(0);
}
void DialogTool::ArrowLeftUp(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(135);
}
void DialogTool::ArrowLeftDown(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(225);
}
void DialogTool::ArrowRightUp(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(45);
}
void DialogTool::ArrowRightDown(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(315);
}
void DialogTool::EvalFormula(){
Q_CHECK_PTR(lineEditFormula);
Q_CHECK_PTR(labelResultCalculation);
Q_ASSERT(lineEditFormula != 0);
Q_ASSERT(labelResultCalculation != 0);
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
}
@ -291,6 +305,14 @@ void DialogTool::LengthLines(){
ShowVariable(data->DataLengthLines());
}
void DialogTool::LengthArcs(){
ShowVariable(data->DataLengthArcs());
}
void DialogTool::LengthCurves(){
ShowVariable(data->DataLengthSplines());
}
void DialogTool::Increments(){
ShowVariable(data->DataIncrementTable());
}
@ -300,29 +322,35 @@ void DialogTool::PutHere(){
}
void DialogTool::PutVal(QListWidgetItem *item){
Q_CHECK_PTR(lineEditFormula);
QString val = item->text();
lineEditFormula->setText(lineEditFormula->text().append(val));
Q_ASSERT(lineEditFormula != 0);
Q_ASSERT(item != 0);
int pos = lineEditFormula->cursorPosition();
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
item->text()));
lineEditFormula->setFocus();
lineEditFormula->setCursorPosition(pos + item->text().size());
}
void DialogTool::ValChenged(int row){
Q_CHECK_PTR(listWidget);
Q_CHECK_PTR(labelDescription);
Q_CHECK_PTR(radioButtonSizeGrowth);
Q_CHECK_PTR(radioButtonStandartTable);
Q_CHECK_PTR(radioButtonIncrements);
Q_CHECK_PTR(radioButtonLengthLine);
Q_ASSERT(listWidget != 0);
Q_ASSERT(labelDescription != 0);
Q_ASSERT(radioButtonSizeGrowth != 0);
Q_ASSERT(radioButtonStandartTable != 0);
Q_ASSERT(radioButtonIncrements != 0);
Q_ASSERT(radioButtonLengthLine != 0);
Q_ASSERT(radioButtonLengthArc != 0);
Q_ASSERT(radioButtonLengthCurve != 0);
if(listWidget->count() == 0){
return;
}
QListWidgetItem *item = listWidget->item( row );
if(radioButtonSizeGrowth->isChecked()){
if(item->text()=="Р"){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg("Зріст");
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg(tr("Growth"));
labelDescription->setText(desc);
}
if(item->text()=="Сг"){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg("Розмір");
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size"));
labelDescription->setText(desc);
}
return;
@ -343,16 +371,32 @@ void DialogTool::ValChenged(int row){
}
if(radioButtonLengthLine->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text()))
.arg("Довжина лінії");
.arg(tr("Line length"));
labelDescription->setText(desc);
return;
}
if(radioButtonLengthArc->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthArc(item->text()))
.arg(tr("Arc length"));
labelDescription->setText(desc);
return;
}
if(radioButtonLengthCurve->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthSpline(item->text()))
.arg(tr("Curve length"));
labelDescription->setText(desc);
return;
}
}
void DialogTool::UpdateList(){
if(radioButtonSizeGrowth == 0 || radioButtonStandartTable == 0 || radioButtonIncrements == 0){
return;
}
Q_ASSERT(radioButtonSizeGrowth != 0);
Q_ASSERT(radioButtonStandartTable != 0);
Q_ASSERT(radioButtonIncrements != 0);
Q_ASSERT(radioButtonLengthLine != 0);
Q_ASSERT(radioButtonLengthArc != 0);
Q_ASSERT(radioButtonLengthCurve != 0);
if(radioButtonSizeGrowth->isChecked()){
ShowVariable(data->DataBase());
}
@ -362,6 +406,15 @@ void DialogTool::UpdateList(){
if(radioButtonIncrements->isChecked()){
ShowVariable(data->DataIncrementTable());
}
if(radioButtonLengthLine->isChecked()){
ShowVariable(data->DataLengthLines());
}
if(radioButtonLengthArc->isChecked()){
ShowVariable(data->DataLengthArcs());
}
if(radioButtonLengthCurve->isChecked()){
ShowVariable(data->DataLengthSplines());
}
}
bool DialogTool::CheckObject(const qint64 &id){
@ -373,25 +426,25 @@ bool DialogTool::CheckObject(const qint64 &id){
}
template <class key, class val>
void DialogTool::ShowVariable(const QMap<key, val> *var){
Q_CHECK_PTR(listWidget);
void DialogTool::ShowVariable(const QHash<key, val> *var){
Q_ASSERT(listWidget != 0);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
QMapIterator<key, val> i(*var);
QHashIterator<key, val> i(*var);
QMap<key, val> map;
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
map.insert(i.key(), i.value());
}
QMapIterator<key, val> iMap(map);
while (iMap.hasNext()) {
iMap.next();
QListWidgetItem *item = new QListWidgetItem(iMap.key());
item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item);
}
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->setCurrentRow (0);
}
qint64 DialogTool::getIdDetail() const{
return idDetail;
}
void DialogTool::setIdDetail(const qint64 &value){
idDetail = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,26 +23,19 @@
#define DIALOGTOOL_H
#include <QDialog>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QLineEdit>
#include <QListWidget>
#include <QLabel>
#include <QRadioButton>
#include <QTimer>
#include "container/vcontainer.h"
#include <container/vcontainer.h>
class DialogTool : public QDialog{
Q_OBJECT
public:
DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
virtual ~DialogTool();
qint64 getIdDetail() const;
void setIdDetail(const qint64 &value);
virtual ~DialogTool() {}
inline qint64 getIdDetail() const {return idDetail;}
inline void setIdDetail(const qint64 &value) {idDetail = value;}
signals:
void DialogClosed(int result);
void ToolTip(const QString &toolTip);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
void NamePointChanged();
@ -61,6 +54,8 @@ public slots:
void SizeGrowth();
void StandartTable();
void LengthLines();
void LengthArcs();
void LengthCurves();
void Increments();
void PutHere();
void PutVal(QListWidgetItem * item);
@ -79,10 +74,14 @@ protected:
QListWidget *listWidget;
QLabel *labelResultCalculation;
QLabel *labelDescription;
QLabel *labelEditNamePoint;
QLabel *labelEditFormula;
QRadioButton *radioButtonSizeGrowth;
QRadioButton *radioButtonStandartTable;
QRadioButton *radioButtonIncrements;
QRadioButton *radioButtonLengthLine;
QRadioButton *radioButtonLengthArc;
QRadioButton *radioButtonLengthCurve;
qint64 idDetail;
Draw::Draws mode;
bool CheckObject(const qint64 &id);
@ -92,7 +91,7 @@ protected:
void FillComboBoxTypeLine(QComboBox *box) const;
virtual void CheckState();
QString GetTypeLine(const QComboBox *box)const;
template <class key, class val> void ShowVariable(const QMap<key, val> *var);
template <class key, class val> void ShowVariable(const QHash<key, val> *var);
void SetupTypeLine(QComboBox *box, const QString &value);
void ChangeCurrentText(QComboBox *box, const QString &value);
void ChangeCurrentData(QComboBox *box, const qint64 &value) const;

106
dialogs/dialogtriangle.cpp Normal file
View File

@ -0,0 +1,106 @@
#include "dialogtriangle.h"
#include "ui_dialogtriangle.h"
DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
axisP2Id(0), firstPointId(0), secondPointId(0){
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogTriangle::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected);
FillComboBoxPoints(ui->comboBoxAxisP1);
FillComboBoxPoints(ui->comboBoxAxisP2);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
}
DialogTriangle::~DialogTriangle(){
delete ui;
}
void DialogTriangle::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
return;
}
}
if(mode == Draw::Modeling){
if(!CheckObject(id)){
return;
}
}
if(type == Scene::Point){
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
} else {
point = data->GetModelingPoint(id);
}
switch(number){
case(0):
ChangeCurrentText(ui->comboBoxAxisP1, point.name());
number++;
emit ToolTip(tr("Select second point of axis"));
break;
case(1):
ChangeCurrentText(ui->comboBoxAxisP2, point.name());
number++;
emit ToolTip(tr("Select first point"));
break;
case(2):
ChangeCurrentText(ui->comboBoxFirstPoint, point.name());
number++;
emit ToolTip(tr("Select second point"));
break;
case(3):
ChangeCurrentText(ui->comboBoxSecondPoint, point.name());
number = 0;
emit ToolTip(tr(""));
if(!isInitialized){
this->show();
}
break;
}
}
}
void DialogTriangle::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
axisP1Id = getCurrentPointId(ui->comboBoxAxisP1);
axisP2Id = getCurrentPointId(ui->comboBoxAxisP2);
emit DialogClosed(QDialog::Accepted);
}
void DialogTriangle::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
void DialogTriangle::setSecondPointId(const qint64 &value, const qint64 &id){
secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
void DialogTriangle::setFirstPointId(const qint64 &value, const qint64 &id){
firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
void DialogTriangle::setAxisP2Id(const qint64 &value, const qint64 &id){
axisP2Id = value;
setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
}
void DialogTriangle::setAxisP1Id(const qint64 &value, const qint64 &id){
axisP1Id = value;
setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
}

61
dialogs/dialogtriangle.h Normal file
View File

@ -0,0 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2013 Valentina project All Rights Reserved.
**
** This file is part of Valentina.
**
** Tox 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 DIALOGTRIANGLE_H
#define DIALOGTRIANGLE_H
#include "dialogtool.h"
namespace Ui {
class DialogTriangle;
}
class DialogTriangle : public DialogTool{
Q_OBJECT
public:
DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogTriangle();
inline qint64 getAxisP1Id() const {return axisP1Id;}
void setAxisP1Id(const qint64 &value, const qint64 &id);
inline qint64 getAxisP2Id() const {return axisP2Id;}
void setAxisP2Id(const qint64 &value, const qint64 &id);
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogTriangle)
Ui::DialogTriangle *ui;
qint32 number;
QString pointName;
qint64 axisP1Id;
qint64 axisP2Id;
qint64 firstPointId;
qint64 secondPointId;
};
#endif // DIALOGTRIANGLE_H

196
dialogs/dialogtriangle.ui Normal file
View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogTriangle</class>
<widget class="QDialog" name="DialogTriangle">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>267</width>
<height>220</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>First point of axis</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxAxisP1">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Second point of axis</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxAxisP2">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>First point</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Second point</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogTriangle</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>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogTriangle</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -25,9 +25,6 @@ VException::VException(const QString &what):QException(), what(what){
Q_ASSERT_X(!what.isEmpty(), Q_FUNC_INFO, "Error message is empty");
}
VException::VException(const VException &e):what(e.What()){
}
QString VException::ErrorMessage() const{
QString error = QString("Exception: %1").arg(what);
return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -24,19 +24,17 @@
#define VEXCEPTION_H
#include <QException>
#include <QString>
class VException : public QException
{
class VException : public QException{
public:
VException(const QString &what);
VException(const VException &e);
VException(const VException &e):what(e.What()){}
virtual ~VException() noexcept(true){}
void raise() const { throw *this; }
VException *clone() const { return new VException(*this); }
inline void raise() const { throw *this; }
inline VException *clone() const { return new VException(*this); }
virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const { return QString(); }
QString What() const {return what;}
inline QString What() const {return what;}
protected:
QString what;
};

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,17 +21,6 @@
#include "vexceptionbadid.h"
VExceptionBadId::VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id),
key(QString()){
}
VExceptionBadId::VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key)
{
}
VExceptionBadId::VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){
}
QString VExceptionBadId::ErrorMessage() const{
QString error;
if(key.isEmpty()){

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -24,16 +24,16 @@
#include "vexception.h"
class VExceptionBadId : public VException
{
class VExceptionBadId : public VException{
public:
VExceptionBadId(const QString &what, const qint64 &id);
VExceptionBadId(const QString &what, const QString &key);
VExceptionBadId(const VExceptionBadId &e);
VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id),
key(QString()){}
VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key){}
VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){}
virtual ~VExceptionBadId() noexcept(true){}
virtual QString ErrorMessage() const;
qint64 BadId() const {return id; }
QString BadKey() const {return key; }
inline qint64 BadId() const {return id; }
inline QString BadKey() const {return key; }
protected:
qint64 id;
QString key;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -26,10 +26,6 @@ VExceptionConversionError::VExceptionConversionError(const QString &what, const
Q_ASSERT_X(!str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty");
}
VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e):
VException(e), str(e.String()){
}
QString VExceptionConversionError::ErrorMessage() const{
QString error = QString("ExceptionConversionError: %1 %2").arg(what, str);
return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -24,14 +24,13 @@
#include "vexception.h"
class VExceptionConversionError : public VException
{
class VExceptionConversionError : public VException{
public:
VExceptionConversionError(const QString &what, const QString &str);
VExceptionConversionError(const VExceptionConversionError &e);
VExceptionConversionError(const VExceptionConversionError &e):VException(e), str(e.String()){}
virtual ~VExceptionConversionError() noexcept(true) {}
virtual QString ErrorMessage() const;
QString String() const {return str;}
inline QString String() const {return str;}
protected:
QString str;
};

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,25 +20,18 @@
****************************************************************************/
#include "vexceptionemptyparameter.h"
#include <QDebug>
VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name,
const QDomElement &domElement): VException(what),
name(name), tagText(QString()), tagName(QString()), lineNumber(-1){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty");
if(domElement.isText()){
QDomText text = domElement.toText();
tagText = text.data();
}
QTextStream stream(&tagText);
domElement.save(stream, 4);
tagName = domElement.tagName();
lineNumber = domElement.lineNumber();
}
VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e),
name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){
}
QString VExceptionEmptyParameter::ErrorMessage() const{
QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name);
return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,20 +23,20 @@
#define VEXCEPTIONEMPTYPARAMETER_H
#include "vexception.h"
#include <QDomElement>
class VExceptionEmptyParameter : public VException
{
class VExceptionEmptyParameter : public VException{
public:
VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement);
VExceptionEmptyParameter(const VExceptionEmptyParameter &e);
VExceptionEmptyParameter(const QString &what, const QString &name,
const QDomElement &domElement);
VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e), name(e.Name()),
tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){}
virtual ~VExceptionEmptyParameter() noexcept(true) {}
virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const;
QString Name() const {return name;}
QString TagText() const {return tagText;}
QString TagName() const {return tagName;}
qint32 LineNumber() const {return lineNumber;}
inline QString Name() const {return name;}
inline QString TagText() const {return tagText;}
inline QString TagName() const {return tagName;}
inline qint32 LineNumber() const {return lineNumber;}
protected:
QString name;
QString tagText;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -25,18 +25,12 @@
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement):
VException(what), tagText(QString()), tagName(QString()), lineNumber(-1), moreInfo(QString()){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
if(domElement.isText()){
QDomText text = domElement.toText();
tagText = text.data();
}
QTextStream stream(&tagText);
domElement.save(stream, 4);
tagName = domElement.tagName();
lineNumber = domElement.lineNumber();
}
VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e):VException(e),
tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){
}
QString VExceptionObjectError::ErrorMessage() const{
QString error = QString("ExceptionObjectError: %1").arg(what);
return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,21 +23,20 @@
#define VEXCEPTIONOBJECTERROR_H
#include "vexception.h"
#include <QDomElement>
class VExceptionObjectError : public VException
{
class VExceptionObjectError : public VException{
public:
VExceptionObjectError(const QString &what, const QDomElement &domElement);
VExceptionObjectError(const VExceptionObjectError &e);
VExceptionObjectError(const VExceptionObjectError &e):VException(e), tagText(e.TagText()),
tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){}
virtual ~VExceptionObjectError() noexcept(true) {}
virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const;
QString TagText() const {return tagText;}
QString TagName() const {return tagName;}
qint32 LineNumber() const {return lineNumber;}
inline QString TagText() const {return tagText;}
inline QString TagName() const {return tagName;}
inline qint32 LineNumber() const {return lineNumber;}
void AddMoreInformation(const QString &info);
QString MoreInformation() const {return moreInfo;}
inline QString MoreInformation() const {return moreInfo;}
protected:
QString tagText;
QString tagName;

View File

@ -0,0 +1,20 @@
#include "vexceptionuniqueid.h"
VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QTextStream stream(&tagText);
domElement.save(stream, 4);
tagName = domElement.tagName();
lineNumber = domElement.lineNumber();
}
QString VExceptionUniqueId::ErrorMessage() const{
QString error = QString("ExceptionUniqueId: %1").arg(what);
return error;
}
QString VExceptionUniqueId::DetailedInformation() const{
QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText);
return detail;
}

View File

@ -0,0 +1,23 @@
#ifndef VEXCEPTIONUNIQUEID_H
#define VEXCEPTIONUNIQUEID_H
#include "vexception.h"
class VExceptionUniqueId : public VException{
public:
VExceptionUniqueId(const QString &what, const QDomElement &domElement);
VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()),
tagName(e.TagName()), lineNumber(e.LineNumber()){}
virtual ~VExceptionUniqueId() noexcept(true){}
virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const;
inline QString TagText() const {return tagText;}
inline QString TagName() const {return tagName;}
inline qint32 LineNumber() const {return lineNumber;}
protected:
QString tagText;
QString tagName;
qint32 lineNumber;
};
#endif // VEXCEPTIONUNIQUEID_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -25,18 +25,12 @@
VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, const QDomElement &domElement):
VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
if(domElement.isText()){
QDomText text = domElement.toText();
tagText = text.data();
}
QTextStream stream(&tagText);
domElement.save(stream, 4);
tagName = domElement.tagName();
lineNumber = domElement.lineNumber();
}
VExceptionWrongParameterId::VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e),
tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){
}
QString VExceptionWrongParameterId::ErrorMessage() const{
QString error = QString("ExceptionWrongParameterId: %1").arg(what);
return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,19 +23,18 @@
#define VEXCEPTIONWRONGPARAMETERID_H
#include "vexception.h"
#include <QDomElement>
class VExceptionWrongParameterId : public VException
{
class VExceptionWrongParameterId : public VException{
public:
VExceptionWrongParameterId(const QString &what, const QDomElement &domElement);
VExceptionWrongParameterId(const VExceptionWrongParameterId &e);
VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e),tagText(e.TagText()),
tagName(e.TagName()), lineNumber(e.LineNumber()){}
virtual ~VExceptionWrongParameterId() noexcept(true){}
virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const;
QString TagText() const {return tagText;}
QString TagName() const {return tagName;}
qint32 LineNumber() const {return lineNumber;}
inline QString TagText() const {return tagText;}
inline QString TagName() const {return tagName;}
inline qint32 LineNumber() const {return lineNumber;}
protected:
QString tagText;
QString tagName;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,16 +20,16 @@
****************************************************************************/
#include "varc.h"
#include <QDebug>
#include <exception/vexception.h>
VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
center(0), points(0), mode(Draw::Calculation), idObject(0){
center(0), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){
}
VArc::VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject)
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
center(center), points(points), mode(mode), idObject(idObject){
center(center), points(*points), mode(mode), idObject(idObject){
}
VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
@ -52,44 +52,12 @@ VArc &VArc::operator =(const VArc &arc){
return *this;
}
qreal VArc::GetF1() const{
return f1;
}
QString VArc::GetFormulaF1() const{
return formulaF1;
}
qreal VArc::GetF2() const{
return f2;
}
QString VArc::GetFormulaF2() const{
return formulaF2;
}
qreal VArc::GetLength () const{
return M_PI * radius/180 * (f2-f1);
}
qreal VArc::GetRadius() const{
return radius;
}
QString VArc::GetFormulaRadius() const{
return formulaRadius;
}
qint64 VArc::GetCenter() const{
return center;
}
QPointF VArc::GetCenterPoint() const{
if(points->contains(center)){
return points->value(center).toQPointF();
if(points.contains(center)){
return points.value(center).toQPointF();
} else {
qCritical()<<"Не можу знайти id = "<<center<<" в таблиці.";
throw"Не можу знайти точку за id.";
QString error = QString(tr("Can't find id = %1 in table.")).arg(center);
throw VException(error);
}
return QPointF();
}
@ -108,7 +76,7 @@ QPointF VArc::GetP2 () const{
return centerP2.p2();
}
const QMap<qint64, VPointF> *VArc::GetDataPoints() const{
const QHash<qint64, VPointF> VArc::GetDataPoints() const{
return points;
}
@ -133,9 +101,10 @@ qreal VArc::AngleArc() const{
qint32 VArc::NumberSplOfArc() const{
qint32 angArc = static_cast<qint32> (AngleArc ());
switch( angArc ){
case 0:
throw "Кут дуги не може бути 0 градусів.";
break;
case 0:{
QString error = QString(tr("Angle of arc can't be 0 degree."));
throw VException(error);
}
case 90:
return 1;
case 180:
@ -161,7 +130,8 @@ QVector<QPointF> VArc::GetPoints() const{
QVector<QPointF> VArc::SplOfArc(qint32 number) const{
qint32 n = NumberSplOfArc ();
if( number > n ){
throw "Дуга не складається з такої кількості сплайнів.";
QString error = QString(tr("Arc have not this number of part."));
throw VException(error);
}
qreal f1 = GetF1 ();
qreal f2 = GetF2 ();
@ -194,19 +164,3 @@ QVector<QPointF> VArc::SplOfArc(qint32 number) const{
}
return QVector<QPointF>();
}
Draw::Draws VArc::getMode() const{
return mode;
}
void VArc::setMode(const Draw::Draws &value){
mode = value;
}
qint64 VArc::getIdObject() const{
return idObject;
}
void VArc::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -28,6 +28,7 @@
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
*/
class VArc{
Q_DECLARE_TR_FUNCTIONS(VArc)
public:
/**
* @brief VArc конструктор по замовчуванню.
@ -40,7 +41,7 @@ public:
* @param f1 початковий кут в градусах.
* @param f2 кінцевий кут в градусах.
*/
VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2 , QString formulaF2,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VArc(const VArc &arc);
@ -49,30 +50,30 @@ public:
* @brief GetF1 повертає початковий кут дуги.
* @return повертає кут в градусах.
*/
QString GetFormulaF1 () const;
qreal GetF1 () const;
inline QString GetFormulaF1 () const {return formulaF1;}
inline qreal GetF1 () const {return f1;}
/**
* @brief GetF2 повертає кінцевий кут дуги.
* @return повертає кут в градусах.
*/
QString GetFormulaF2 () const;\
qreal GetF2 () const;
inline QString GetFormulaF2 () const {return formulaF2;}
inline qreal GetF2 () const {return f2;}
/**
* @brief GetLength повертає довжину дуги.
* @return повертає довжину дуги.
*/
qreal GetLength () const;
inline qreal GetLength () const {return M_PI * radius/180 * (f2-f1);}
/**
* @brief GetRadius повертає радіус дуги.
* @return повертає радіус дуги.
*/
QString GetFormulaRadius () const;
qreal GetRadius () const;
inline QString GetFormulaRadius () const {return formulaRadius;}
inline qreal GetRadius () const {return radius;}
/**
* @brief GetCenter повертає точку центра дуги.
* @return повертає точку центра дуги.
*/
qint64 GetCenter () const;
inline qint64 GetCenter () const {return center;}
QPointF GetCenterPoint() const;
/**
* @brief GetP1 повертає першу точку з якої починається дуга.
@ -84,7 +85,7 @@ public:
* @return точку кінця дуги.
*/
QPointF GetP2 () const;
const QMap<qint64, VPointF> *GetDataPoints() const;
const QHash<qint64, VPointF> GetDataPoints() const;
/**
* @brief GetPath будує шлях по даній дузі.
* @return повертає шлях.
@ -94,11 +95,10 @@ public:
qint32 NumberSplOfArc () const;
QVector<QPointF> GetPoints () const;
QVector<QPointF> SplOfArc( qint32 number ) const;
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
qint64 getIdObject() const;
void setIdObject(const qint64 &value);
inline Draw::Draws getMode() const {return mode;}
inline void setMode(const Draw::Draws &value) {mode = value;}
inline qint64 getIdObject() const {return idObject;}
inline void setIdObject(const qint64 &value) {idObject = value;}
private:
/**
* @brief f1 початковий кут в градусах
@ -119,7 +119,7 @@ private:
* @brief center центральна точка дуги.
*/
qint64 center;
const QMap<qint64, VPointF> *points;
QHash<qint64, VPointF> points;
Draw::Draws mode;
qint64 idObject;
};

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,16 +21,28 @@
#include "vdetail.h"
VDetail::VDetail():nodes(QVector<VNodeDetail>()),name(QString()), mx(0), my(0){
VDetail::VDetail():nodes(QVector<VNodeDetail>()),name(QString()), mx(0), my(0), supplement(true), closed(true),
width(10){
}
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes):nodes(QVector<VNodeDetail>()),
name(name), mx(0), my(0){
name(name), mx(0), my(0), supplement(true), closed(true), width(10){
this->nodes = nodes;
}
void VDetail::append(const VNodeDetail &node){
nodes.append(node);
VDetail::VDetail(const VDetail &detail):nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()),
my(detail.getMy()), supplement(detail.getSupplement()), closed(detail.getClosed()), width(detail.getWidth()){
}
VDetail &VDetail::operator =(const VDetail &detail){
nodes = detail.getNodes();
name = detail.getName();
mx = detail.getMx();
my = detail.getMy();
supplement = detail.getSupplement();
closed = detail.getClosed();
width = detail.getWidth();
return *this;
}
void VDetail::Clear(){
@ -38,10 +50,9 @@ void VDetail::Clear(){
name.clear();
mx = 0;
my = 0;
}
qint32 VDetail::CountNode() const{
return nodes.size();
supplement = true;
closed = true;
width = 10;
}
bool VDetail::Containes(const qint64 &id) const{
@ -58,26 +69,3 @@ VNodeDetail &VDetail::operator [](int indx){
return nodes[indx];
}
qreal VDetail::getMy() const{
return my;
}
void VDetail::setMy(const qreal &value){
my = value;
}
qreal VDetail::getMx() const{
return mx;
}
void VDetail::setMx(const qreal &value){
mx = value;
}
QString VDetail::getName() const{
return name;
}
void VDetail::setName(const QString &value){
name = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,9 +23,6 @@
#define VDETAIL_H
#include "vnodedetail.h"
#include <QVector>
#include <QString>
#include <QPainterPath>
namespace Detail {
enum Contour { OpenContour, CloseContour };
@ -41,22 +38,35 @@ class VDetail{
public:
VDetail();
VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
void append(const VNodeDetail &node);
VDetail(const VDetail &detail);
VDetail &operator=(const VDetail &detail);
inline void append(const VNodeDetail &node) {nodes.append(node);}
void Clear();
qint32 CountNode() const;
inline qint32 CountNode() const {return nodes.size();}
bool Containes(const qint64 &id)const;
VNodeDetail & operator[](int indx);
QString getName() const;
void setName(const QString &value);
qreal getMx() const;
void setMx(const qreal &value);
qreal getMy() const;
void setMy(const qreal &value);
inline QString getName() const {return name;}
inline void setName(const QString &value) {name = value;}
inline qreal getMx() const {return mx;}
inline void setMx(const qreal &value) {mx = value;}
inline qreal getMy() const {return my;}
inline void setMy(const qreal &value) {my = value;}
inline bool getSupplement() const {return supplement;}
inline void setSupplement(bool value) {supplement = value;}
inline bool getClosed() const {return closed;}
inline void setClosed(bool value) {closed = value;}
inline qreal getWidth() const {return width;}
inline void setWidth(const qreal &value) {width = value;}
inline QVector<VNodeDetail> getNodes() const {return nodes;}
inline void setNodes(const QVector<VNodeDetail> &value) {nodes = value;}
private:
QVector<VNodeDetail> nodes;
QString name;
qreal mx;
qreal my;
bool supplement;
bool closed;
qreal width;
};
#endif // VDETAIL_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -21,46 +21,25 @@
#include "vnodedetail.h"
VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Calculation),
typeNode(NodeDetail::Contour){
VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Modeling),
typeNode(NodeDetail::Contour), mx(0), my(0){
}
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode):id(id),
typeTool(typeTool), mode(mode), typeNode(typeNode){
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
qreal mx, qreal my):id(id), typeTool(typeTool), mode(mode), typeNode(typeNode),
mx(mx), my(my){
}
VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(node.getTypeTool()),
mode(node.getMode()), typeNode(node.getTypeNode()){
mode(node.getMode()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){
}
Tool::Tools VNodeDetail::getTypeTool() const{
return typeTool;
}
void VNodeDetail::setTypeTool(const Tool::Tools &value){
typeTool = value;
}
qint64 VNodeDetail::getId() const{
return id;
}
void VNodeDetail::setId(const qint64 &value){
id = value;
}
Draw::Draws VNodeDetail::getMode() const{
return mode;
}
void VNodeDetail::setMode(const Draw::Draws &value){
mode = value;
}
NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{
return typeNode;
}
void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){
typeNode = value;
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node){
id = node.getId();
typeTool = node.getTypeTool();
mode = node.getMode();
typeNode = node.getTypeNode();
mx = node.getMx();
my = node.getMy();
return *this;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -31,26 +31,32 @@ namespace NodeDetail {
}
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails)
class VNodeDetail
{
class VNodeDetail{
public:
VNodeDetail();
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode);
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
qreal mx = 0, qreal my = 0);
VNodeDetail(const VNodeDetail &node);
qint64 getId() const;
void setId(const qint64 &value);
Tool::Tools getTypeTool() const;
void setTypeTool(const Tool::Tools &value);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
NodeDetail::NodeDetails getTypeNode() const;
void setTypeNode(const NodeDetail::NodeDetails &value);
VNodeDetail &operator=(const VNodeDetail &node);
inline qint64 getId() const {return id;}
inline void setId(const qint64 &value) {id = value;}
inline Tool::Tools getTypeTool() const {return typeTool;}
inline void setTypeTool(const Tool::Tools &value) {typeTool = value;}
inline Draw::Draws getMode() const {return mode;}
inline void setMode(const Draw::Draws &value) {mode = value;}
inline NodeDetail::NodeDetails getTypeNode() const {return typeNode;}
inline void setTypeNode(const NodeDetail::NodeDetails &value) {typeNode = value;}
inline qreal getMx() const {return mx;}
inline void setMx(const qreal &value) {mx = value;}
inline qreal getMy() const {return my;}
inline void setMy(const qreal &value) {my = value;}
private:
qint64 id;
Tool::Tools typeTool;
Draw::Draws mode;
NodeDetail::NodeDetails typeNode;
qreal mx;
qreal my;
};
Q_DECLARE_METATYPE(VNodeDetail)

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,10 +20,9 @@
****************************************************************************/
#include "vspline.h"
#include <QDebug>
VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
kCurve(1), points(0), mode(Draw::Calculation), idObject(0){
kCurve(1), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){
}
VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()),
@ -32,16 +31,16 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2
mode(spline.getMode()), idObject(spline.getIdObject()){
}
VSpline::VSpline (const QMap<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()),
p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points),
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()),
p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(*points),
mode(mode), idObject(idObject){
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
}
VSpline::VSpline (const QMap<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0),
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), mode(mode), idObject(idObject){
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), mode(mode), idObject(idObject){
ModifiSpl ( p1, p2, p3, p4, kCurve);
}
@ -124,13 +123,9 @@ void VSpline::ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCu
// p4 = QPointF(p4.x()+mx, p4.y()+my);
//}
qint64 VSpline::GetP1 () const{
return p1;
}
VPointF VSpline::GetPointP1() const{
if(points->contains(p1)){
return points->value(p1);
if(points.contains(p1)){
return points.value(p1);
} else {
qCritical()<<"Не можу знайти id = "<<p1<<" в таблиці.";
throw"Не можу знайти точку за id.";
@ -138,21 +133,9 @@ VPointF VSpline::GetPointP1() const{
return VPointF();
}
QPointF VSpline::GetP2 () const{
return p2;
}
QPointF VSpline::GetP3 () const{
return p3;
}
qint64 VSpline::GetP4() const{
return p4;
}
VPointF VSpline::GetPointP4() const{
if(points->contains(p4)){
return points->value(p4);
if(points.contains(p4)){
return points.value(p4);
} else {
qCritical()<<"Не можу знайти id = "<<p4<<" в таблиці.";
throw"Не можу знайти точку за id.";
@ -160,14 +143,6 @@ VPointF VSpline::GetPointP4() const{
return VPointF();
}
qreal VSpline::GetAngle1() const{
return angle1;
}
qreal VSpline::GetAngle2 () const{
return angle2;
}
qreal VSpline::GetLength () const{
return LengthBezier ( GetPointP1().toQPointF(), this->p2, this->p3, GetPointP4().toQPointF());
}
@ -178,22 +153,6 @@ QString VSpline::GetName() const{
return QString("Spl_%1_%2").arg(first.name(), second.name());
}
qreal VSpline::GetKasm1() const{
return kAsm1;
}
qreal VSpline::GetKasm2() const{
return kAsm2;
}
qreal VSpline::GetKcurve() const{
return kCurve;
}
const QMap<qint64, VPointF> *VSpline::GetDataPoints() const{
return points;
}
QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const{
QVector<qreal> px;
QVector<qreal> py;
@ -320,25 +279,6 @@ QVector<QPointF> VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF
}
qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const{
/*QVector<qreal> px;
QVector<qreal> py;
QVector<qreal>& wpx = px;
QVector<qreal>& wpy = py;
px.append ( p1.x () );
py.append ( p1.y () );
PointBezier_r ( p1.x (), p1.y (), p2.x (), p2.y (),
p3.x (), p3.y (), p4.x (), p4.y (), 0, wpx, wpy);
px.append ( p4.x () );
py.append ( p4.y () );
qint32 i = 0;
qreal length = 0.0;
*
* Наприклад маємо 10 точок. Від 0 до 9 і останню точку не опрацьовуємо.
* Тому від 0 до 8(<10-1).
*
for ( i = 0; i < px.count() - 1; ++i ){
length += QLineF ( QPointF ( px[i], py[i] ), QPointF ( px[i+1], py[i+1] ) ).length ();
}*/
QPainterPath splinePath;
QVector<QPointF> points = GetPoints (p1, p2, p3, p4);
splinePath.moveTo(points[0]);
@ -620,9 +560,13 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2){
QPainterPath VSpline::GetPath() const{
QPainterPath splinePath;
QVector<QPointF> points = GetPoints ();
splinePath.moveTo(points[0]);
for (qint32 i = 1; i < points.count(); ++i){
splinePath.lineTo(points[i]);
if(points.count() >= 2){
for (qint32 i = 0; i < points.count()-1; ++i){
splinePath.moveTo(points[i]);
splinePath.lineTo(points[i+1]);
}
} else {
qWarning()<<"points.count() < 2"<<Q_FUNC_INFO;
}
return splinePath;
}
@ -642,44 +586,44 @@ QPainterPath VSpline::GetPath() const{
2 - 1 real root + complex roots imaginary part is zero
(i.e. 2 real roots).
*/
qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){
qreal q,r,r2,q3;
//qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){
// qreal q,r,r2,q3;
q = (a*a - 3.*b)/9.;
r = (a*(2.*a*a - 9.*b) + 27.*c)/54.;
r2 = r*r;
q3 = pow(q,3);
if(r2<q3) {
qreal t = acos(r/sqrt(q3));
a/=3.;
q = -2.*sqrt(q);
x[0] = q*cos(t/3.)-a;
x[1] = q*cos((t + M_2PI)/3.) - a;
x[2] = q*cos((t - M_2PI)/3.) - a;
return(3);
} else {
qreal aa,bb;
if(r<=0.){
r=-r;
}
aa = -pow(r + sqrt(r2-q3),1./3.);
if(aa!=0.){
bb=q/aa;
} else {
bb=0.;
}
a/=3.;
q = aa+bb;
r = aa-bb;
x[0] = q-a;
x[1] = (-0.5)*q-a;
x[2] = (sqrt(3.)*0.5)*fabs(r);
if(x[2]==0.){
return(2);
}
return(1);
}
}
// q = (a*a - 3.*b)/9.;
// r = (a*(2.*a*a - 9.*b) + 27.*c)/54.;
// r2 = r*r;
// q3 = pow(q,3);
// if(r2<q3) {
// qreal t = acos(r/sqrt(q3));
// a/=3.;
// q = -2.*sqrt(q);
// x[0] = q*cos(t/3.)-a;
// x[1] = q*cos((t + M_2PI)/3.) - a;
// x[2] = q*cos((t - M_2PI)/3.) - a;
// return(3);
// } else {
// qreal aa,bb;
// if(r<=0.){
// r=-r;
// }
// aa = -pow(r + sqrt(r2-q3),1./3.);
// if(aa!=0.){
// bb=q/aa;
// } else {
// bb=0.;
// }
// a/=3.;
// q = aa+bb;
// r = aa-bb;
// x[0] = q-a;
// x[1] = (-0.5)*q-a;
// x[2] = (sqrt(3.)*0.5)*fabs(r);
// if(x[2]==0.){
// return(2);
// }
// return(1);
// }
//}
//qreal VSpline::calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3,
// qreal curve_coord4, qreal point_coord) const{
@ -752,14 +696,6 @@ qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){
// this->ModifiSpl(P1, P2, P3, P4);
//}
Draw::Draws VSpline::getMode() const{
return mode;
}
void VSpline::setMode(const Draw::Draws &value){
mode = value;
}
QVector<QPointF> VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve){
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());
@ -776,14 +712,6 @@ QVector<QPointF> VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qre
return GetPoints(p1, p2, p3, p4);
}
qint64 VSpline::getIdObject() const{
return idObject;
}
void VSpline::setIdObject(const qint64 &value){
idObject = value;
}
VSpline &VSpline::operator =(const VSpline &spline){
this->p1 = spline.GetP1 ();
this->p2 = spline.GetP2 ();

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -22,12 +22,9 @@
#ifndef VSPLINE_H
#define VSPLINE_H
#define M_2PI 6.28318530717958647692528676655900576
#include <container/vpointf.h>
#include <QPainterPath>
#include <QVector>
#include <QMap>
#include "container/vpointf.h"
#define M_2PI 6.28318530717958647692528676655900576
/**
* @brief VSpline клас, що реалізує сплайн.
@ -50,9 +47,9 @@ public:
* @param kAsm1 коефіцієнт довжини першої напрямної.
* @param kAsm2 коефіцієнт довжини другої напрямної.
*/
VSpline (const QMap<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1,
qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode = Draw::Calculation,
qint64 idObject = 0);
/**
* @brief VSpline конструктор.
* @param p1 початкова точка сплайну.
@ -60,9 +57,8 @@ public:
* @param p3 друга контролююча точка сплайну.
* @param p4 кінцева точка сплайну.
*/
VSpline (const QMap<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3,
qint64 p4, qreal kCurve, Draw::Draws mode = Draw::Calculation,
qint64 idObject = 0);
VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
/**
* @brief ModifiSpl модифікує сплайн.
* @param p1 початкова точка сплайну.
@ -99,44 +95,44 @@ public:
* @brief GetP1 повертає першу точку сплайну.
* @return перша точка сплайну.
*/
qint64 GetP1 () const;
qint64 GetP1 () const {return p1;}
VPointF GetPointP1() const;
/**
* @brief GetP2 повертує першу контрольну точку сплайну.
* @return перша контрольна точка сплайну.
*/
QPointF GetP2 () const;
inline QPointF GetP2 () const {return p2;}
/**
* @brief GetP3 повертає другу контрольну точку сплайну.
* @return друга контрольна точка сплайну.
*/
QPointF GetP3 () const;
inline QPointF GetP3 () const {return p3;}
/**
* @brief GetP4 повертає останню точку сплайну.
* @return остання точка сплайну.
*/
qint64 GetP4 () const;
inline qint64 GetP4 () const {return p4;}
VPointF GetPointP4 () const;
/**
* @brief GetAngle1 повертає кут першої напрямної.
* @return кут в градусах.
*/
qreal GetAngle1 () const;
inline qreal GetAngle1 () const {return angle1;}
/**
* @brief GetAngle2 повертає кут другої напрямної.
* @return кут в градусах.
*/
qreal GetAngle2() const;
inline qreal GetAngle2() const {return angle2;}
/**
* @brief GetLength повертає довжину сплайну.
* @return довжина сплайну.
*/
qreal GetLength () const;
QString GetName () const;
qreal GetKasm1() const;
qreal GetKasm2() const;
qreal GetKcurve() const;
const QMap<qint64, VPointF> *GetDataPoints() const;
inline qreal GetKasm1() const {return kAsm1;}
inline qreal GetKasm2() const {return kAsm2;}
inline qreal GetKcurve() const {return kCurve;}
inline const QHash<qint64, VPointF> GetDataPoints() const {return points;}
/**
* @brief CrossingSplLine перевіряє перетин сплайну з лінією.
* @param line лінія з якою перевіряється перетин.
@ -179,12 +175,12 @@ public:
* @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну.
*/
// void Mirror(const QPointF Pmirror);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
static QVector<QPointF> SplinePoints(QPointF p1, QPointF p4, qreal angle1,
qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve);
qint64 getIdObject() const;
void setIdObject(const qint64 &value);
inline Draw::Draws getMode() const {return mode;}
inline void setMode(const Draw::Draws &value) {mode = value;}
static QVector<QPointF> SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
qreal kCurve);
inline qint64 getIdObject() const {return idObject;}
inline void setIdObject(const qint64 &value) {idObject = value;}
VSpline &operator=(const VSpline &spl);
protected:
/**
@ -224,7 +220,7 @@ private:
qreal kAsm1;
qreal kAsm2;
qreal kCurve;
const QMap<qint64, VPointF> *points;
QHash<qint64, VPointF> points;
Draw::Draws mode;
qint64 idObject;
/**
@ -250,8 +246,7 @@ private:
* @param px список х координат точок сплайну.
* @param py список у коодринат сплайну.
*/
static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
qreal x3, qreal y3, qreal x4, qreal y4,
static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4,
qint16 level, QVector<qreal> &px, QVector<qreal> &py);
/**
* @brief CalcSqDistance розраховує довжину між точками.
@ -262,15 +257,15 @@ private:
* @return довжину.
*/
static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2);
/**
* @brief Cubic знаходить розв'язок кубічного рівняння.
* @param x коефіцієнт.
* @param a коефіцієнт.
* @param b коефіцієнт.
* @param c коефіцієнт.
* @return повертає корені рівняння.
*/
static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c);
// /**
// * @brief Cubic знаходить розв'язок кубічного рівняння.
// * @param x коефіцієнт.
// * @param a коефіцієнт.
// * @param b коефіцієнт.
// * @param c коефіцієнт.
// * @return повертає корені рівняння.
// */
// static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c);
/**
* @brief calc_t знаходить параметр t якому відповідає точка на сплайні.
* @param curve_coord1 координата Х або У кривої.
@ -280,8 +275,8 @@ private:
* @param point_coord координата Х або У точки на кривій.
* @return
*/
// static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3,
// qreal curve_coord4, qreal point_coord)const;
// static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, qreal curve_coord4,
// qreal point_coord)const;
/**
* @brief param_t знаходить підходяще значення параметра t якому відповідає точка на сплайні
* @param pBt точка для якої шукається значення параметра t.

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -20,14 +20,14 @@
****************************************************************************/
#include "vsplinepath.h"
#include "exception/vexception.h"
#include <exception/vexception.h>
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(0),
idObject(0){
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation),
points(QHash<qint64, VPointF>()), idObject(0){
}
VSplinePath::VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()),
kCurve(kCurve), mode(mode), points(points), idObject(idObject){
VSplinePath::VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()),
kCurve(kCurve), mode(mode), points(*points), idObject(idObject){
}
VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
@ -35,14 +35,6 @@ VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
idObject(splPath.getIdObject()){
}
Draw::Draws VSplinePath::getMode() const{
return mode;
}
void VSplinePath::setMode(const Draw::Draws &value){
mode = value;
}
void VSplinePath::append(VSplinePoint point){
path.append(point);
}
@ -55,10 +47,6 @@ qint32 VSplinePath::Count() const{
}
}
qint32 VSplinePath::CountPoint() const{
return path.size();
}
VSpline VSplinePath::GetSpline(qint32 index) const{
if(Count()<1){
throw VException(tr("Not enough points to create the spline."));
@ -66,7 +54,7 @@ VSpline VSplinePath::GetSpline(qint32 index) const{
if(index < 1 || index > Count()){
throw VException(tr("This spline is not exist."));
}
VSpline spl(points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(),
VSpline spl(&points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(),
path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve);
return spl;
}
@ -74,8 +62,8 @@ VSpline VSplinePath::GetSpline(qint32 index) const{
QPainterPath VSplinePath::GetPath() const{
QPainterPath painterPath;
for(qint32 i = 1; i <= Count(); ++i){
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
path[i].KAsm1(), this->kCurve);
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
painterPath.addPath(spl.GetPath());
}
return painterPath;
@ -84,34 +72,26 @@ QPainterPath VSplinePath::GetPath() const{
QVector<QPointF> VSplinePath::GetPathPoints() const{
QVector<QPointF> pathPoints;
for(qint32 i = 1; i <= Count(); ++i){
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
path[i].KAsm1(), this->kCurve);
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
QVector<QPointF> splP = spl.GetPoints();
for(qint32 j = 0; i < splP.size(); ++j){
for(qint32 j = 0; j < splP.size(); ++j){
pathPoints.append(splP[j]);
}
}
return pathPoints;
}
QVector<VSplinePoint> VSplinePath::GetSplinePath() const{
return path;
}
qreal VSplinePath::GetLength() const{
qreal length = 0;
for(qint32 i = 1; i <= Count(); ++i){
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
path[i].KAsm1(), kCurve);
length += spl.GetLength();
}
return length;
}
const QMap<qint64, VPointF> *VSplinePath::GetDataPoints() const{
return points;
}
void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point){
if(indexSpline < 1 || indexSpline > Count()){
throw VException(tr("This spline is not exist."));
@ -134,22 +114,6 @@ VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Positi
}
}
void VSplinePath::Clear(){
path.clear();
}
qreal VSplinePath::getKCurve() const{
return kCurve;
}
void VSplinePath::setKCurve(const qreal &value){
kCurve = value;
}
const QVector<VSplinePoint> *VSplinePath::GetPoint() const{
return &path;
}
VSplinePath &VSplinePath::operator =(const VSplinePath &path){
this->path = path.GetSplinePath();
this->kCurve = path.getKCurve();
@ -162,11 +126,3 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path){
VSplinePoint & VSplinePath::operator[](int indx){
return path[indx];
}
qint64 VSplinePath::getIdObject() const{
return idObject;
}
void VSplinePath::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -23,8 +23,9 @@
#define VSPLINEPATH_H
#include "vsplinepoint.h"
#include <container/vpointf.h>
#include "vspline.h"
#include <QCoreApplication>
#include <QApplication>
namespace SplinePoint{
enum Position { FirstPoint, LastPoint };
@ -45,7 +46,7 @@ public:
/**
* @brief VSplinePath конструктор по замовчуванню.
*/
VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve = 1,
VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve = 1,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VSplinePath(const VSplinePath& splPath);
/**
@ -54,29 +55,29 @@ public:
*/
void append(VSplinePoint point);
qint32 Count() const;
qint32 CountPoint() const;
inline qint32 CountPoint() const {return path.size();}
VSpline GetSpline(qint32 index) const;
QPainterPath GetPath() const;
QVector<QPointF> GetPathPoints() const;
QVector<VSplinePoint> GetSplinePath() const;
inline QVector<VSplinePoint> GetSplinePath() const {return path;}
qreal GetLength() const;
const QMap<qint64, VPointF> *GetDataPoints() const;
inline QHash<qint64, VPointF> GetDataPoints() const {return points;}
void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point);
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
/**
* @brief Clear очищає шлях сплайнів.
*/
void Clear();
qreal getKCurve() const;
void setKCurve(const qreal &value);
const QVector<VSplinePoint> *GetPoint() const;
inline void Clear() {path.clear();}
inline qreal getKCurve() const {return kCurve;}
inline void setKCurve(const qreal &value) {kCurve = value;}
inline const QVector<VSplinePoint> *GetPoint() const {return &path;}
VSplinePath &operator=(const VSplinePath &path);
VSplinePoint &operator[](int indx);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
inline Draw::Draws getMode() const {return mode;}
inline void setMode(const Draw::Draws &value) {mode = value;}
qint64 getIdObject() const;
void setIdObject(const qint64 &value);
inline qint64 getIdObject() const {return idObject;}
inline void setIdObject(const qint64 &value) {idObject = value;}
protected:
/**
@ -85,7 +86,7 @@ protected:
QVector<VSplinePoint> path;
qreal kCurve;
Draw::Draws mode;
const QMap<qint64, VPointF> *points;
QHash<qint64, VPointF> points;
qint64 idObject;
};

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -32,41 +32,8 @@ VSplinePoint::VSplinePoint(const VSplinePoint &point):pSpline(point.P()), angle(
kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){
}
VSplinePoint::~VSplinePoint(){
}
qint64 VSplinePoint::P() const{
return pSpline;
}
void VSplinePoint::SetP(const qint64 &value){
pSpline = value;
}
qreal VSplinePoint::Angle1() const{
return angle+180;
}
void VSplinePoint::SetAngle(const qreal &value){
angle = value;
}
qreal VSplinePoint::Angle2() const{
return angle;
}
qreal VSplinePoint::KAsm1() const{
return kAsm1;
}
void VSplinePoint::SetKAsm1(const qreal &value){
kAsm1 = value;
}
qreal VSplinePoint::KAsm2() const{
return kAsm2;
}
void VSplinePoint::SetKAsm2(const qreal &value){
kAsm2 = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Tox is distributed in the hope that it will be useful,
** 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.
@ -41,36 +41,36 @@ public:
*/
VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle, qreal kAsm2);
VSplinePoint(const VSplinePoint &point);
~VSplinePoint();
~VSplinePoint() {}
/**
* @brief P повертає точку.
* @return точка.
*/
qint64 P() const;
void SetP(const qint64 &value);
inline qint64 P() const {return pSpline;}
inline void SetP(const qint64 &value) {pSpline = value;}
/**
* @brief Angle1 повертає кут дотичної сплайна.
* @return кут в градусах.
*/
qreal Angle1() const;
void SetAngle(const qreal &value);
inline qreal Angle1() const {return angle+180;}
inline void SetAngle(const qreal &value) {angle = value;}
/**
* @brief Angle2 повертає кут дотичної сплайна.
* @return кут в градусах.
*/
qreal Angle2() const;
inline qreal Angle2() const {return angle;}
/**
* @brief KAsm1 повертає коефіцієнт довжини дотичної.
* @return коефіцієнт.
*/
qreal KAsm1() const;
void SetKAsm1(const qreal &value);
inline qreal KAsm1() const {return kAsm1;}
inline void SetKAsm1(const qreal &value) {kAsm1 = value;}
/**
* @brief KAsm2 повертає коефіцієнт довжини дотичної.
* @return коефіцієнт.
*/
qreal KAsm2() const;
void SetKAsm2(const qreal &value);
inline qreal KAsm2() const {return kAsm2;}
inline void SetKAsm2(const qreal &value) {kAsm2 = value;}
protected:
/**
* @brief pSpline точка сплайну.

View File

@ -34,5 +34,8 @@
<file>icon/32x32/new_detail.png</file>
<file>icon/32x32/layout.png</file>
<file>icon/16x16/mirror.png</file>
<file>icon/32x32/height.png</file>
<file>icon/32x32/triangle.png</file>
<file>icon/32x32/point_of_intersection.png</file>
</qresource>
</RCC>

Some files were not shown because too many files have changed in this diff Show More