Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-08-17 18:00:56 +02:00
commit 10f2d83edd
75 changed files with 284 additions and 172 deletions

View File

@ -54,6 +54,8 @@
- [#526] Dialog Detail is not on top after selection second object on Mac.
- [#532] Unexpected error occurs when zoom out image.
- [#537] Valentina crashes when use undo command.
- [#544] Error: Color Lines are black until touched.
- [#543] Detail loses details.
# Version 0.4.4 April 12, 2016
- Updated measurement templates with all measurements. Added new template Aldrich/Women measurements.

View File

@ -121,7 +121,7 @@ init:
# Path before
- path
- set QTDIR=C:\%QT5%
- set PATH=%QTDIR%\bin;C:\Tools\PsTools;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Mercurial\
- set PATH=%QTDIR%\bin;%QTDIR%\include;C:\Tools\PsTools;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Mercurial\
# Installing various utilities
#- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" choco install -y InnoSetup
#- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" if "%PLATFORM%" == "x86" set PATH="C:\Program Files\Inno Setup 5";%PATH%
@ -181,4 +181,6 @@ notifications:
- dismine@gmail.com
- susan.spencer@gmail.com
- zhuravska19@gmail.com
on_build_success: false
on_build_failure: true
on_build_status_changed: true

25
scripts/cppcheck.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# This script helps run cppcheck with the same keys we have on codeship.com (except for key --platform=unix32).
# Please, run this script from folder <root_folder>/scripts.
# Because we use the last available cppcheck version usually we build it manually.
CPPCHECK="../../../../cppcheck/cppcheck"
$CPPCHECK \
-j4 -f -q \
-U__INTEL_COMPILER_UPDATE \
-UqApp \
--template '{file}:{line}:{message}:{id}' \
--inline-suppr \
--platform=unix32 \
--std=c++11 \
--std=posix \
--enable=all \
--library=qt.cfg \
--library=std.cfg \
--library=posix.cfg \
--inconclusive \
--suppress=leakReturnValNotUsed:../src/app/valentina/core/vapplication.cpp \
--suppress=unmatchedSuppression:../src/libs/ifc/xml/vdomdocument.cpp \
--suppress=redundantCondition:../src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp \
--suppress=unmatchedSuppression:../src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp \
../src

View File

@ -35,15 +35,15 @@
#include "../vwidgets/vmaingraphicsview.h"
#include "../version.h"
#include "../vmisc/logging.h"
#include "../vmisc/vmath.h"
#include "../qmuparser/qmuparsererror.h"
#include "../mainwindow.h"
#include <QDebug>
#include <QtDebug>
#include <QDir>
#include <QProcess>
#include <QTemporaryFile>
#include <QUndoStack>
#include <QtCore/qmath.h>
#include <QTemporaryFile>
#include <QFile>
#include <QStandardPaths>

View File

@ -31,12 +31,7 @@
#include "../core/vapplication.h"
#include "../ifc/xml/vdomdocument.h"
#include "../vmisc/vsettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
# include <QtMath>
#endif
#include "../vmisc/vmath.h"
#include <QMessageBox>
#include <QPushButton>

View File

@ -37,7 +37,7 @@
#include <QFileDialog>
#include <QMessageBox>
#include <QProcess>
#include <QDebug>
#include <QtDebug>
const QString baseFilenameRegExp = QStringLiteral("^[\\w\\-. ]+$");

View File

@ -59,7 +59,7 @@
#include "dialogs/vwidgetdetails.h"
#include <QInputDialog>
#include <QDebug>
#include <QtDebug>
#include <QMessageBox>
#include <QShowEvent>
#include <QScrollBar>

View File

@ -41,6 +41,7 @@
#include "../ifc/xml/vpatternconverter.h"
#include "../vmisc/undoevent.h"
#include "../vmisc/vsettings.h"
#include "../vmisc/vmath.h"
#include "../qmuparser/qmuparsererror.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vsplinepath.h"
@ -53,7 +54,6 @@
#include <QMessageBox>
#include <QUndoStack>
#include <QtCore/qmath.h>
#include <QtNumeric>
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");

View File

@ -26,7 +26,6 @@
#include <QApplication>
#include <QByteArray>
#include <QDate>
#include <QDebug>
#include <QDesktopServices>
#include <QLatin1String>
#include <QMessageBox>

View File

@ -28,7 +28,6 @@
#include "vabstractpattern.h"
#include <QDebug>
#include <QDomNode>
#include <QDomNodeList>
#include <QLatin1String>

View File

@ -47,7 +47,6 @@
#include <QAbstractMessageHandler>
#include <QByteArray>
#include <QDebug>
#include <QDomNodeList>
#include <QDomText>
#include <QFile>

View File

@ -30,7 +30,6 @@
#define VDOMDOCUMENT_H
#include <QCoreApplication>
#include <QDebug>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNode>

View File

@ -21,8 +21,6 @@
#include "qmuparser.h"
#include <QtCore/qmath.h>
#include <math.h>
#include <QCoreApplication>
#include <QStaticStringData>
#include <QStringData>
@ -33,6 +31,7 @@
#include "qmuparserdef.h"
#include "qmuparsererror.h"
#include "../vmisc/vmath.h"
using namespace std;

View File

@ -21,7 +21,6 @@
#include "qmuparserbase.h"
#include <QDebug>
#include <QList>
#include <QMessageLogger>
#include <QStack>
@ -29,14 +28,14 @@
#include <QTextStream>
#include <QtDebug>
#include <map>
#include "qmudef.h"
#ifdef QMUP_USE_OPENMP
#include <omp.h>
#endif
#include <QtCore/qmath.h>
#include <assert.h>
#include "qmudef.h"
#include "../vmisc/vmath.h"
using namespace std;
/**

View File

@ -21,9 +21,7 @@
#include "qmuparserbytecode.h"
#include <QtCore/qmath.h>
#include <assert.h>
#include <QDebug>
#include <QMessageLogger>
#include <QStack>
#include <QString>
@ -31,6 +29,7 @@
#include "qmudef.h"
#include "qmuparsererror.h"
#include "../vmisc/vmath.h"
namespace qmu
{

View File

@ -21,11 +21,9 @@
#include "qmuparsertest.h"
#include <math.h>
#include <stdio.h>
#include <QChar>
#include <QCoreApplication>
#include <QDebug>
#include <QMessageLogger>
#include <QString>
#include <QtDebug>
@ -41,6 +39,7 @@
#include "qmudef.h"
#include "qmuparser.h"
#include "qmuparsererror.h"
#include "../vmisc/vmath.h"
using namespace std;

View File

@ -23,7 +23,6 @@
#include <assert.h>
#include <QCharRef>
#include <QDebug>
#include <QList>
#include <QMessageLogger>
#include <QStringList>

View File

@ -27,8 +27,7 @@
#include "dl_global.h"
#include <math.h>
#include "../vmisc/vmath.h"
/**
* Storing and passing around attributes. Attributes

View File

@ -28,11 +28,9 @@
#include "vdxfengine.h"
#include <math.h>
#include <QByteArray>
#include <QColor>
#include <QDateTime>
#include <QDebug>
#include <QFlag>
#include <QFlags>
#include <QFont>
@ -49,6 +47,7 @@
#include "../vmisc/def.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/vmath.h"
#include "dxflib/dl_attributes.h"
#include "dxflib/dl_codes.h"
#include "dxflib/dl_dxf.h"
@ -65,11 +64,6 @@ class QPolygonF;
class QRect;
class QRectF;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
//---------------------------------------------------------------------------------------------------------------------
static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
{

View File

@ -30,7 +30,6 @@
#include <qnumeric.h>
#include <QDate>
#include <QDebug>
#include <QDomNode>
#include <QDomNodeList>
#include <QDomText>

View File

@ -28,14 +28,13 @@
#include "vabstractcubicbezier.h"
#include <math.h>
#include <QDebug>
#include <QLineF>
#include <QMessageLogger>
#include <QPoint>
#include <QtDebug>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../vgeometry/vpointf.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -28,7 +28,6 @@
#include "vabstractcurve.h"
#include <QDebug>
#include <QLine>
#include <QLineF>
#include <QMessageLogger>

View File

@ -28,11 +28,11 @@
#include "varc.h"
#include <QtCore/qmath.h>
#include <QLineF>
#include <QPointF>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../ifc/ifcdef.h"
#include "vabstractcurve.h"
#include "varc_p.h"

View File

@ -31,11 +31,11 @@
#include <QSharedData>
#include <QLineF>
#include <QtCore/qmath.h>
#include "vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/vmath.h"
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -28,21 +28,16 @@
#include "vcubicbezierpath.h"
#include <qmath.h>
#include <QLineF>
#include <QPoint>
#include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "vabstractcurve.h"
#include "vcubicbezierpath_p.h"
#include "vspline.h"
#include "vsplinepoint.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
//---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(quint32 idObject, Draw mode)
: VAbstractCubicBezierPath(GOType::CubicBezierPath, idObject, mode),

View File

@ -28,12 +28,11 @@
#include "vellipticalarc.h"
#include <QtCore/qmath.h>
#include <math.h>
#include <QLineF>
#include <QPoint>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "vabstractcurve.h"

View File

@ -28,8 +28,6 @@
#include "vgobject.h"
#include <QtCore/qmath.h>
#include <math.h>
#include <QLine>
#include <QLineF>
#include <QPoint>
@ -37,9 +35,12 @@
#include <QRectF>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../ifc/ifcdef.h"
#include "vgobject_p.h"
double VGObject::accuracyPointOnLine = (0.5/*mm*/ / 25.4) * PrintDPI;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VGObject default constructor.
@ -505,14 +506,16 @@ double VGObject::PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPoi
* There is the floating-point accuraccy problem, so instead of checking against zero, some epsilon value has to be
* used. Because the size of the pdp value depends on the length of the vectors, no static value can be used. One
* approach is to compare the pdp/area value to the fraction of another area which also depends on the length of the
* line e1=(p1, p2), e.g. the area of the square with side e1 which is computed below
* line e1=(p1, p2), e.g. the minimal area calucalted with PerpDotProduc() if point still not on the line. This distance
* is controled by variable accuracyPointOnLine
*/
double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
{
const double dx1 = p2.x() - p1.x();
const double dy1 = p2.y() - p1.y();
const double epsilon = 0.06 * (dx1 * dx1 + dy1 * dy1); //-V636
return epsilon;
QLineF line(p1, p2);
line.setAngle(line.angle() + 90);
line.setLength(accuracyPointOnLine); // less than accuracy means the same point
return qAbs(PerpDotProduct(p1, p2, line.p2()));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -91,6 +91,8 @@ public:
static QVector<QPointF> GetReversePoints(const QVector<QPointF> &points);
static int GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints);
static double accuracyPointOnLine;
private:
QSharedDataPointer<VGObjectData> d;

View File

@ -28,11 +28,11 @@
#include "vspline.h"
#include <math.h>
#include <QLineF>
#include "vabstractcurve.h"
#include "vspline_p.h"
#include "../vmisc/vmath.h"
class QPointF;

View File

@ -31,10 +31,10 @@
#include <QSharedData>
#include <QLineF>
#include <QtCore/qmath.h>
#include "vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -31,14 +31,10 @@
#include <QPoint>
#include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "vabstractcurve.h"
#include "vsplinepath_p.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSplinePath constructor.

View File

@ -30,7 +30,7 @@
#define VSPLINEPOINT_P_H
#include <QSharedData>
#include <QDebug>
#include <QtDebug>
#include "vpointf.h"
#include "../vmisc/def.h"

View File

@ -28,7 +28,6 @@
#include "vabstractdetail.h"
#include <QDebug>
#include <QLine>
#include <QLineF>
#include <QMessageLogger>

View File

@ -28,7 +28,6 @@
#include "vcontour.h"
#include <qmath.h>
#include <QLineF>
#include <QPainterPath>
#include <QPoint>
@ -39,11 +38,7 @@
#include "vcontour_p.h"
#include "vlayoutdetail.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
#include "../vmisc/vmath.h"
//---------------------------------------------------------------------------------------------------------------------
VContour::VContour()

View File

@ -28,8 +28,6 @@
#include "vlayoutdetail.h"
#include <math.h>
#include <qmath.h>
#include <QBrush>
#include <QFlags>
#include <QFont>
@ -47,6 +45,7 @@
#include "../vpatterndb/vpatterninfogeometry.h"
#include "../vpatterndb/vpatternpiecedata.h"
#include "../vmisc/vmath.h"
#include "vlayoutdef.h"
#include "vlayoutdetail_p.h"
#include "vtextmanager.h"
@ -55,13 +54,6 @@ class QGraphicsPathItem;
class QLineF;
class VAbstractPattern;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
#include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
VLayoutDetail::VLayoutDetail()
:VAbstractDetail(), d(new VLayoutDetailData)

View File

@ -28,12 +28,12 @@
#include "vlayoutgenerator.h"
#include <QtCore/qmath.h>
#include <QGraphicsRectItem>
#include <QRectF>
#include <QThreadPool>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "vlayoutdetail.h"
#include "vlayoutpaper.h"

View File

@ -28,7 +28,6 @@
#include "vposition.h"
#include <qmath.h>
#include <QDir>
#include <QImage>
#include <QLineF>
@ -48,11 +47,7 @@
#include <Qt>
#include "../vmisc/def.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
#include "../vmisc/vmath.h"
//---------------------------------------------------------------------------------------------------------------------
VPosition::VPosition(const VContour &gContour, int j, const VLayoutDetail &detail, int i, volatile bool *stop,

View File

@ -28,7 +28,6 @@
#include "vposter.h"
#include <qmath.h>
#include <QGraphicsLineItem>
#include <QGraphicsPixmapItem>
#include <QGraphicsTextItem>
@ -40,11 +39,7 @@
#include <QVector>
#include <Qt>
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
#include "../vmisc/vmath.h"
#include "../vmisc/def.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#include <QDebugStateSaver>
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
#include <QDataStream>
#include <QDebug>
#include <QtDebug>
/*!
\class QMarginsF

View File

@ -33,7 +33,6 @@
#include <QColor>
#include <QComboBox>
#include <QCursor>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QGuiApplication>

View File

@ -28,7 +28,6 @@
#include "vabstractapplication.h"
#include <QDebug>
#include <QDir>
#include <QLibraryInfo>
#include <QLoggingCategory>

View File

@ -30,7 +30,6 @@
#include <QApplication>
#include <QDate>
#include <QDebug>
#include <QDir>
#include <QLocale>
#include <QMessageLogger>
@ -41,14 +40,10 @@
#include <QtDebug>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
class QDate;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
const QString VCommonSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VCommonSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
const QString VCommonSettings::SettingPathsTemplates = QStringLiteral("paths/templates");

View File

@ -18,10 +18,12 @@
**
****************************************************************************/
#ifndef QMATH_H
#define QMATH_H
#ifndef VMATH_H
#define VMATH_H
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
#include <QtMath>
#else
#if 0
#pragma qt_class(QtMath)

View File

@ -39,14 +39,10 @@
#include <QVariant>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
class QMarginsF;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
Q_DECLARE_METATYPE(QMarginsF)
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");

View File

@ -28,9 +28,7 @@
#include "vobjengine.h"
#include <qmath.h>
#include <QByteArray>
#include <QDebug>
#include <QFlag>
#include <QFlags>
#include <QIODevice>
@ -45,6 +43,7 @@
#include <QtDebug>
#include "../vmisc/diagnostic.h"
#include "../vmisc/vmath.h"
class QPaintDevice;
class QPixmap;
@ -53,11 +52,6 @@ class QPointF;
class QPolygonF;
class QRectF;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
#ifdef Q_CC_MSVC
#include <ciso646>
#endif /* Q_CC_MSVC */

View File

@ -28,23 +28,18 @@
#include "vlineangle.h"
#include <qmath.h>
#include <QLineF>
#include <QMessageLogger>
#include <QPointF>
#include <QString>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"
#include "vinternalvariable.h"
#include "vlineangle_p.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
//---------------------------------------------------------------------------------------------------------------------
VLineAngle::VLineAngle()
:VInternalVariable(), d(new VLineAngleData)

View File

@ -28,7 +28,6 @@
#include "vmeasurement.h"
#include <QDebug>
#include <QMap>
#include <QMessageLogger>
#include <QtDebug>

View File

@ -29,7 +29,6 @@
#include "vcontainer.h"
#include <limits.h>
#include <QDebug>
#include <QLoggingCategory>
#include <QVector>
#include <QtDebug>

View File

@ -28,7 +28,6 @@
#include "vdetail.h"
#include <QDebug>
#include <QList>
#include <QMessageLogger>
#include <QPainterPath>

View File

@ -29,7 +29,6 @@
#include "vformula.h"
#include <qnumeric.h>
#include <QDebug>
#include <QMessageLogger>
#include <QScopedPointer>
#include <QtDebug>

View File

@ -28,7 +28,6 @@
#include "vtranslatevars.h"
#include <QDebug>
#include <QList>
#include <QLocale>
#include <QMap>

View File

@ -48,6 +48,7 @@
#include "../../visualization/visualization.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "dialogtool.h"
@ -55,11 +56,6 @@
class QWidget;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
//---------------------------------------------------------------------------------------------------------------------
DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint32 &toolId, QWidget *parent)
: DialogTool(data, toolId, parent),

View File

@ -32,7 +32,6 @@
#include <QByteArray>
#include <QCheckBox>
#include <QComboBox>
#include <QDebug>
#include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QFlags>

View File

@ -33,7 +33,6 @@
#include <qnumeric.h>
#include <QCloseEvent>
#include <QComboBox>
#include <QDebug>
#include <QDoubleSpinBox>
#include <QEvent>
#include <QHash>

View File

@ -28,8 +28,6 @@
#include "vtoolspline.h"
#include <math.h>
#include <qmath.h>
#include <QDomElement>
#include <QEvent>
#include <QFlags>
@ -63,6 +61,7 @@
#include "../vgeometry/vpointf.h"
#include "../vgeometry/vspline.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vcontrolpointspline.h"
#include "../vwidgets/vmaingraphicsscene.h"
@ -75,11 +74,6 @@ class QGraphicsSceneContextMenuEvent;
class QGraphicsSceneHoverEvent;
class QGraphicsSceneMouseEvent;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
const QString VToolSpline::ToolType = QStringLiteral("simpleInteractive");
const QString VToolSpline::OldToolType = QStringLiteral("simple");

View File

@ -28,8 +28,6 @@
#include "vtoolsplinepath.h"
#include <math.h>
#include <qmath.h>
#include <QDomElement>
#include <QEvent>
#include <QFlags>
@ -67,6 +65,7 @@
#include "../vgeometry/vspline.h"
#include "../vgeometry/vsplinepoint.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/../vgeometry/vsplinepath.h"
#include "../vwidgets/vcontrolpointspline.h"
@ -80,11 +79,6 @@ class QGraphicsSceneContextMenuEvent;
class QGraphicsSceneHoverEvent;
class QGraphicsSceneMouseEvent;
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
#else
#endif
const QString VToolSplinePath::ToolType = QStringLiteral("pathInteractive");
const QString VToolSplinePath::OldToolType = QStringLiteral("path");

View File

@ -76,7 +76,8 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
QPointF point1 = *data->GeometricObject<VPointF>(basePointId);
QPointF point2 = *data->GeometricObject<VPointF>(id);
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
mainLine->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
}
@ -93,7 +94,7 @@ VToolLinePoint::~VToolLinePoint()
*/
void VToolLinePoint::RefreshGeometry()
{
mainLine->setPen(QPen(CorrectColor(QColor(lineColor)),
mainLine->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));

View File

@ -28,7 +28,6 @@
#include "vtoolshoulderpoint.h"
#include <QDebug>
#include <QLineF>
#include <QMessageLogger>
#include <QSharedPointer>

View File

@ -28,7 +28,6 @@
#include "vtoolpointofcontact.h"
#include <QDebug>
#include <QLineF>
#include <QMessageLogger>
#include <QSharedPointer>

View File

@ -28,7 +28,6 @@
#include "vtooltriangle.h"
#include <QtCore/qmath.h>
#include <QLine>
#include <QLineF>
#include <QSharedPointer>
@ -50,6 +49,7 @@
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h"
#include "../vmisc/vmath.h"
class QDomElement;
class QGraphicsSceneContextMenuEvent;

View File

@ -29,7 +29,6 @@
#include "vdrawtool.h"
#include <qnumeric.h>
#include <QDebug>
#include <QDialog>
#include <QDomNode>
#include <QMessageLogger>

View File

@ -28,7 +28,6 @@
#include "vtoolline.h"
#include <QDebug>
#include <QKeyEvent>
#include <QLineF>
#include <QMessageLogger>
@ -85,7 +84,8 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
this->setAcceptHoverEvents(true);
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
this->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
ToolCreation(typeCreation);
@ -233,7 +233,7 @@ void VToolLine::Disable(bool disable, const QString &namePP)
{
enabled = !CorrectDisable(disable, namePP);
this->setEnabled(enabled);
this->setPen(QPen(CorrectColor(baseColor),
this->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
}

View File

@ -26,8 +26,6 @@
**
*************************************************************************/
#include <math.h>
#include <qmath.h>
#include <QColor>
#include <QFlags>
#include <QFont>
@ -41,6 +39,7 @@
#include <Qt>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "vtextgraphicsitem.h"
class QGraphicsSceneHoverEvent;

View File

@ -30,7 +30,6 @@
#include <QAction>
#include <QBrush>
#include <QDebug>
#include <QDialog>
#include <QDomElement>
#include <QEvent>

View File

@ -29,7 +29,6 @@
#include "vtooluniondetails.h"
#include <QByteArray>
#include <QDebug>
#include <QDomNodeList>
#include <QHash>
#include <QLineF>

View File

@ -28,7 +28,6 @@
#include "visline.h"
#include <QtCore/qmath.h>
#include <QGraphicsScene>
#include <QGuiApplication>
#include <QPen>
@ -37,6 +36,7 @@
#include "../ifc/ifcdef.h"
#include "../vgeometry/vgobject.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vpatterndb/vcontainer.h"
class QPointF;

View File

@ -28,7 +28,6 @@
#include "vistooltriangle.h"
#include <QtCore/qmath.h>
#include <QGraphicsLineItem>
#include <QGraphicsPathItem>
#include <QPainterPath>
@ -41,6 +40,7 @@
#include "../ifc/ifcdef.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
#include "visline.h"

View File

@ -31,7 +31,6 @@
#include <qnumeric.h>
#include <QBrush>
#include <QColor>
#include <QDebug>
#include <QGraphicsEllipseItem>
#include <QGraphicsItem>
#include <QGraphicsLineItem>

View File

@ -28,7 +28,6 @@
#include "vmaingraphicsview.h"
#include <qmath.h>
#include <QApplication>
#include <QCursor>
#include <QEvent>
@ -48,6 +47,7 @@
#include <QWidget>
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "vmaingraphicsscene.h"
#include "vsimplecurve.h"

View File

@ -29,7 +29,6 @@
#include "vsimplecurve.h"
#include <QBrush>
#include <QDebug>
#include <QFlags>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>

View File

@ -27,7 +27,6 @@
*************************************************************************/
#include <QCoreApplication>
#include <QDebug>
#include <QTimer>
#include <QtGlobal>
#include "../qmuparser/qmuparsertest.h"

View File

@ -50,7 +50,8 @@ SOURCES += \
tst_vabstractcurve.cpp \
tst_findpoint.cpp \
tst_vellipticalarc.cpp \
tst_vcubicbezierpath.cpp
tst_vcubicbezierpath.cpp \
tst_vgobject.cpp
win32-msvc*:SOURCES += stable.cpp
@ -71,7 +72,8 @@ HEADERS += \
tst_vabstractcurve.h \
tst_findpoint.h \
tst_vellipticalarc.h \
tst_vcubicbezierpath.h
tst_vcubicbezierpath.h \
tst_vgobject.h
# Set using ccache. Function enable_ccache() defined in common.pri.
$$enable_ccache()

View File

@ -44,6 +44,7 @@
#include "tst_findpoint.h"
#include "tst_vabstractcurve.h"
#include "tst_vcubicbezierpath.h"
#include "tst_vgobject.h"
#include "../vmisc/def.h"
@ -76,6 +77,7 @@ int main(int argc, char** argv)
ASSERT_TEST(new TST_VCommandLine());
ASSERT_TEST(new TST_VAbstractCurve());
ASSERT_TEST(new TST_VCubicBezierPath());
ASSERT_TEST(new TST_VGObject());
return status;
}

View File

@ -0,0 +1,138 @@
/************************************************************************
**
** @file
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 16 8, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "tst_vgobject.h"
#include <QtTest>
#include "../vgeometry/vgobject.h"
#include "../vmisc/def.h"
//---------------------------------------------------------------------------------------------------------------------
TST_VGObject::TST_VGObject(QObject *parent)
:QObject(parent)
{}
//---------------------------------------------------------------------------------------------------------------------
void TST_VGObject::TestIsPointOnLineviaPDP_data()
{
QTest::addColumn<QPointF>("p1");
QTest::addColumn<QPointF>("p2");
QTest::addColumn<QPointF>("t");
QTest::addColumn<bool>("excpect");
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416, 1920.763653543307);
QTest::newRow("Point is on line, but not on segment.") << p1 << p2 << t << true;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416, 2874.763653543307);
QTest::newRow("Point is on segment. On middle.") << p1 << p2 << t << true;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416, 1929.763653543307);
QTest::newRow("Point is on segment. The end of segment.") << p1 << p2 << t << true;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416 + VGObject::accuracyPointOnLine, 2874.763653543307);
QTest::newRow("Min accuracy gap. On middle.") << p1 << p2 << t << false;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416 + VGObject::accuracyPointOnLine, 1929.763653543307);
QTest::newRow("Min accuracy gap.") << p1 << p2 << t << false;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416 + VGObject::accuracyPointOnLine/2., 2874.763653543307);
QTest::newRow("Less than min accuracy gap. On middle.") << p1 << p2 << t << true;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(483.54330708661416 + VGObject::accuracyPointOnLine/2., 1929.763653543307);
QTest::newRow("Less than min accuracy gap.") << p1 << p2 << t << true;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(370.1574803149606, 2874.763653543307);
QTest::newRow("Issue 534 - 3 cm gap. On middle.") << p1 << p2 << t << false;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(370.1574803149606, 1929.763653543307);
QTest::newRow("Issue 534 - 3 cm gap.") << p1 << p2 << t << false;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(407.9527559055118, 2874.763653543307);
QTest::newRow("Issue 534 - 2 cm gap. On middle.") << p1 << p2 << t << false;
}
{
const QPointF p1(483.54330708661416, 3819.527433070866);
const QPointF p2(483.54330708661416, 1929.763653543307);
const QPointF t(407.9527559055118, 1929.763653543307);
QTest::newRow("Issue 534 - 2 cm gap.") << p1 << p2 << t << false;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_VGObject::TestIsPointOnLineviaPDP() const
{
QFETCH(QPointF, p1);
QFETCH(QPointF, p2);
QFETCH(QPointF, t);
QFETCH(bool, excpect);
const bool res = VGObject::IsPointOnLineviaPDP(t, p1, p2);
QCOMPARE(res, excpect);
}

View File

@ -0,0 +1,45 @@
/************************************************************************
**
** @file
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 16 8, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef TST_VGOBJECT_H
#define TST_VGOBJECT_H
#include <QObject>
class TST_VGObject : public QObject
{
Q_OBJECT
public:
explicit TST_VGObject(QObject *parent = nullptr);
private slots:
void TestIsPointOnLineviaPDP_data();
void TestIsPointOnLineviaPDP() const;
};
#endif // TST_VGOBJECT_H