Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-07-29 21:47:49 +02:00
commit c5f38207fd
26 changed files with 415 additions and 50 deletions

164
appveyor.yml Normal file
View File

@ -0,0 +1,164 @@
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: '{build}-{branch}'
os: Visual Studio 2015
# branches to build
branches:
# whitelist
only:
- develop
- release
# Do not build on tags (GitHub and BitBucket)
skip_tags: true
#---------------------------------#
# environment configuration #
#---------------------------------#
# set clone depth
clone_depth: 1 # clone entire repository history if not defined
# fetch repository as zip archive
shallow_clone: false # default is "false"
environment:
matrix:
- QT5: Qt\5.7\mingw53_32
QMAKE_GENERATOR: "MinGW Makefiles"
MINGW_PATH: C:\Qt\Tools\mingw530_32\bin
- QT5: Qt\5.7\msvc2015_64
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 14
- QT5: Qt\5.7\msvc2015
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 14
- QT5: Qt\5.7\msvc2013_64
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.7\msvc2013
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.6\mingw49_32
QMAKE_GENERATOR: "MinGW Makefiles"
MINGW_PATH: C:\Qt\Tools\mingw492_32\bin
- QT5: Qt\5.6\msvc2015_64
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 14
- QT5: Qt\5.6\msvc2015
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 14
- QT5: Qt\5.6\msvc2013_64
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.6\msvc2013
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.5\mingw492_32
QMAKE_GENERATOR: "MinGW Makefiles"
MINGW_PATH: C:\Qt\Tools\mingw492_32\bin
- QT5: Qt\5.5\msvc2013_64
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.5\msvc2013
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.4\mingw491_32
QMAKE_GENERATOR: "MinGW Makefiles"
MINGW_PATH: C:\Qt\Tools\mingw491_32\bin
- QT5: Qt\5.4\msvc2013_64_opengl
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.4\msvc2013_opengl
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.3\mingw482_32
QMAKE_GENERATOR: "MinGW Makefiles"
MINGW_PATH: C:\Qt\Tools\mingw482_32\bin
- QT5: Qt\5.3\msvc2013_64_opengl
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
- QT5: Qt\5.3\msvc2013_opengl
QMAKE_GENERATOR: "NMake Makefiles JOM"
VSVER: 12
# scripts that are called at very beginning, before repo cloning
init:
# Path before
- path
# Installing various utilities
#- choco install cppcheck
#- 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%
#- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" if "%PLATFORM%" == "X64" set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
- set QTDIR=C:\%QT5%
- set PATH=%QTDIR%\bin;C:\Tools\PsTools;C:\Program Files\Mercurial\ #;%PATH%
- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" set PATH=%MINGW_PATH%;%PATH%
- if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH%
- set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH%
# Set VC variables for the platform
- if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" if %PLATFORM% == x64 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
- if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" if %PLATFORM% == x86 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
- ps: $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
- if NOT "%QMAKE_GENERATOR%" == "MinGW Makefiles" echo "Using Visual Studio %VSVER%.0 at %VSCOMNTOOLS%"
- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" echo "Using MinGW"
- if "%CMAKE_GENERATOR%" == "NMake Makefiles JOM" if "%PLATFORM%" == "X86" call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat"
- if "%CMAKE_GENERATOR%" == "NMake Makefiles JOM" if "%PLATFORM%" == "X64" "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- if "%CMAKE_GENERATOR%" == "NMake Makefiles JOM" if "%PLATFORM%" == "X64" call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
# Path after
- path
- qmake -v
#---------------------------------#
# build configuration #
#---------------------------------#
before_build:
- cd c:\projects\valentina
- md build
# to run your custom scripts instead of automatic MSBuild
build_script:
- cd build
#- cppcheck --error-exitcode=1 --quiet --inline-suppr --template '{file}:{line}:{message}:{id}' --force --report-progress --enable=performance,portability ..\src
- qmake ..\Valentina.pro -r CONFIG+=noDebugSymbols CONFIG+=no_ccache CONFIG+=checkWarnings
- if not "%QMAKE_GENERATOR%" == "MinGW Makefiles" (nmake) else (mingw32-make -j%NUMBER_OF_PROCESSORS%)
# scripts to run after build
after_build:
#- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" mingw32-make install
# to run your custom scripts instead of automatic tests
test_script:
- if "%QMAKE_GENERATOR%" == "MinGW Makefiles" (mingw32-make check)
# to disable automatic tests
#test: off
matrix:
fast_finish: true
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
# Email
- provider: Email
to:
- dismine@gmail.com
- susan.spencer@gmail.com
- zhuravska19@gmail.com
on_build_status_changed: true

View File

@ -21,4 +21,4 @@ pipelines:
- make -j$(nproc) - make -j$(nproc)
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/opt/atlassian/bitbucketci/agent/build/build/src/libs/vpropertyexplorer/bin:/opt/atlassian/bitbucketci/agent/build/build/src/libs/qmuparser/bin" - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/opt/atlassian/bitbucketci/agent/build/build/src/libs/vpropertyexplorer/bin:/opt/atlassian/bitbucketci/agent/build/build/src/libs/qmuparser/bin"
# QTestLib require GUI support for some tests # QTestLib require GUI support for some tests
- xvfb-run -a make check - xvfb-run -a make check

View File

@ -45,7 +45,11 @@ for(lang, LANGUAGES) {
# Some systems use special name for lrelease. For example opensuse 13.2 has lrelease-qt5. # Some systems use special name for lrelease. For example opensuse 13.2 has lrelease-qt5.
isEmpty(LRELEASE){ isEmpty(LRELEASE){
LRELEASE = lrelease win32{
LRELEASE = lrelease.exe
} else {
LRELEASE = lrelease
}
} }
# Run generation *.qm file for available *.ts files each time you run qmake. # Run generation *.qm file for available *.ts files each time you run qmake.

View File

@ -680,6 +680,7 @@ void MainWindow::ClosedDialogWithApply(int result)
{ {
VDrawTool *vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool()); VDrawTool *vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
vtool->DialogLinkDestroy(); vtool->DialogLinkDestroy();
connect(vtool, &VDrawTool::ToolTip, this, &MainWindow::ShowToolTip);
} }
ArrowTool(); ArrowTool();
// If insert not to the end of file call lite parse // If insert not to the end of file call lite parse

View File

@ -59,7 +59,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
: QMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr), : VAbstractMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr),
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()), pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()),
shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr), undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr),

View File

@ -37,13 +37,14 @@
#include "xml/vpattern.h" #include "xml/vpattern.h"
#include "dialogs/dialogsavelayout.h" #include "dialogs/dialogsavelayout.h"
#include "../vlayout/vlayoutgenerator.h" #include "../vlayout/vlayoutgenerator.h"
#include "../vwidgets/vabstractmainwindow.h"
class QGraphicsScene; class QGraphicsScene;
class QPrinter; class QPrinter;
class PosterData; class PosterData;
class MainWindowsNoGUI : public QMainWindow class MainWindowsNoGUI : public VAbstractMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -27,6 +27,7 @@
*************************************************************************/ *************************************************************************/
#include "vpattern.h" #include "vpattern.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../vtools/tools/vdatatool.h" #include "../vtools/tools/vdatatool.h"
#include "../vtools/tools/vtooldetail.h" #include "../vtools/tools/vtooldetail.h"
#include "../vtools/tools/vtooluniondetails.h" #include "../vtools/tools/vtooluniondetails.h"
@ -1992,8 +1993,16 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
const QString color = GetParametrString(domElement, AttrColor, ColorBlack); const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0"); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, scene, this, data, parse, VToolSpline *spl = VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, scene, this,
Source::FromFile); data, parse, Source::FromFile);
if (spl != nullptr)
{
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr);
connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
//Rewrite attribute formula. Need for situation when we have wrong formula. //Rewrite attribute formula. Need for situation when we have wrong formula.
if (a1 != angle1 || a2 != angle2 || l1 != length1 || l2 != length2) if (a1 != angle1 || a2 != angle2 || l1 != length1 || l2 != length2)
{ {
@ -2173,7 +2182,16 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
l1 = length1; l1 = length1;
l2 = length2; l2 = length2;
VToolSplinePath::Create(id, points, a1, a2, l1, l2, color, scene, this, data, parse, Source::FromFile); VToolSplinePath *spl = VToolSplinePath::Create(id, points, a1, a2, l1, l2, color, scene, this, data, parse,
Source::FromFile);
if (spl != nullptr)
{
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr);
connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
//Rewrite attribute formula. Need for situation when we have wrong formula. //Rewrite attribute formula. Need for situation when we have wrong formula.
int count = 0; int count = 0;
for (qint32 i = 0; i < num; ++i) for (qint32 i = 0; i < num; ++i)

View File

@ -28,11 +28,28 @@
#include "vbank.h" #include "vbank.h"
#include "vlayoutdetail.h" #include "vlayoutdetail.h"
#include "../vmisc/logging.h"
#include <QPointF> #include <QPointF>
#include <climits> #include <climits>
#include <QRectF> #include <QRectF>
#if defined(Q_CC_CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#elif defined(Q_CC_INTEL)
#pragma warning( push )
#pragma warning( disable: 1418 )
#endif
Q_LOGGING_CATEGORY(lBank, "layout.bank")
#if defined(Q_CC_CLANG)
#pragma clang diagnostic pop
#elif defined(Q_CC_INTEL)
#pragma warning( pop )
#endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBank::VBank() VBank::VBank()
:details(QVector<VLayoutDetail>()), unsorted(QHash<int, qint64>()), big(QHash<int, qint64>()), :details(QVector<VLayoutDetail>()), unsorted(QHash<int, qint64>()), big(QHash<int, qint64>()),
@ -158,12 +175,14 @@ bool VBank::Prepare()
{ {
if (layoutWidth <= 0) if (layoutWidth <= 0)
{ {
qCDebug(lBank, "Preparing data for layout error: Layout paper sheet <= 0");
prepare = false; prepare = false;
return prepare; return prepare;
} }
if (details.isEmpty()) if (details.isEmpty())
{ {
qCDebug(lBank, "Preparing data for layout error: List of details is empty");
prepare = false; prepare = false;
return prepare; return prepare;
} }
@ -183,6 +202,7 @@ bool VBank::Prepare()
const qint64 square = details.at(i).Square(); const qint64 square = details.at(i).Square();
if (square <= 0) if (square <= 0)
{ {
qCDebug(lBank, "Preparing data for layout error: Detail squere <= 0");
prepare = false; prepare = false;
return prepare; return prepare;
} }

View File

@ -29,6 +29,7 @@
#include "dialogcubicbezierpath.h" #include "dialogcubicbezierpath.h"
#include "ui_dialogcubicbezierpath.h" #include "ui_dialogcubicbezierpath.h"
#include "../../visualization/path/vistoolcubicbezierpath.h" #include "../../visualization/path/vistoolcubicbezierpath.h"
#include "../vwidgets/vabstractmainwindow.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h" # include "../vmisc/vmath.h"
@ -128,7 +129,9 @@ void DialogCubicBezierPath::ChosenObject(quint32 id, const SceneObject &type)
if (path.CountPoints() == 1) if (path.CountPoints() == 1)
{ {
visPath->VisualMode(NULL_ID); visPath->VisualMode(NULL_ID);
connect(visPath, &VisToolCubicBezierPath::ToolTip, [this](const QString &toolTip){emit ToolTip(toolTip);}); VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr);
connect(visPath, &VisToolCubicBezierPath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
} }
else else
{ {

View File

@ -36,6 +36,7 @@
#include "../../../vwidgets/vmaingraphicsscene.h" #include "../../../vwidgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h" #include "../../tools/vabstracttool.h"
#include "../support/dialogeditwrongformula.h" #include "../support/dialogeditwrongformula.h"
#include "../vwidgets/vabstractmainwindow.h"
#include <QTimer> #include <QTimer>
@ -217,8 +218,10 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
number++; number++;
line->VisualMode(id); line->VisualMode(id);
connect(line, &VisToolCurveIntersectAxis::ToolTip, VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
[this](const QString &toolTip){emit ToolTip(toolTip);}); SCASSERT(window != nullptr);
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
} }
} }
break; break;

View File

@ -36,6 +36,7 @@
#include "../../../vwidgets/vmaingraphicsscene.h" #include "../../../vwidgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h" #include "../../tools/vabstracttool.h"
#include "../support/dialogeditwrongformula.h" #include "../support/dialogeditwrongformula.h"
#include "../vwidgets/vabstractmainwindow.h"
#include <QTimer> #include <QTimer>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -167,7 +168,9 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxBasePoint, "")) if (SetObject(id, ui->comboBoxBasePoint, ""))
{ {
vis->VisualMode(id); vis->VisualMode(id);
connect(vis.data(), &Visualization::ToolTip, [this](const QString &toolTip){emit ToolTip(toolTip);}); VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr);
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
prepare = true; prepare = true;
} }
} }

View File

@ -36,6 +36,7 @@
#include "../../../vwidgets/vmaingraphicsscene.h" #include "../../../vwidgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h" #include "../../tools/vabstracttool.h"
#include "../support/dialogeditwrongformula.h" #include "../support/dialogeditwrongformula.h"
#include "../vwidgets/vabstractmainwindow.h"
#include <QTimer> #include <QTimer>
@ -242,8 +243,9 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
number++; number++;
line->VisualMode(id); line->VisualMode(id);
connect(line, &VisToolLineIntersectAxis::ToolTip, VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
[this](const QString &toolTip){emit ToolTip(toolTip);}); SCASSERT(window != nullptr);
connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
} }
break; break;
case (1): case (1):

View File

@ -38,6 +38,7 @@
#include "../../visualization/line/vistoolrotation.h" #include "../../visualization/line/vistoolrotation.h"
#include "../support/dialogeditwrongformula.h" #include "../support/dialogeditwrongformula.h"
#include "../qmuparser/qmudef.h" #include "../qmuparser/qmudef.h"
#include "../vwidgets/vabstractmainwindow.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QWidget *parent)
@ -215,8 +216,9 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
{ {
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis); VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
SCASSERT(operation != nullptr); SCASSERT(operation != nullptr);
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
connect(operation, &Visualization::ToolTip, [this](const QString &toolTip){emit ToolTip(toolTip);}); SCASSERT(window != nullptr);
connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
operation->SetOriginPointId(id); operation->SetOriginPointId(id);
operation->RefreshGeometry(); operation->RefreshGeometry();

View File

@ -33,6 +33,7 @@
#include "../../visualization/path/vistoolsplinepath.h" #include "../../visualization/path/vistoolsplinepath.h"
#include "../support/dialogeditwrongformula.h" #include "../support/dialogeditwrongformula.h"
#include "../qmuparser/qmuparsererror.h" #include "../qmuparser/qmuparsererror.h"
#include "../vwidgets/vabstractmainwindow.h"
#include <QTimer> #include <QTimer>
@ -181,7 +182,10 @@ void DialogSplinePath::ChosenObject(quint32 id, const SceneObject &type)
if (path.CountPoints() == 1) if (path.CountPoints() == 1)
{ {
visPath->VisualMode(NULL_ID); visPath->VisualMode(NULL_ID);
connect(visPath, &VisToolSplinePath::ToolTip, [this](const QString &toolTip){emit ToolTip(toolTip);}); VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr);
connect(visPath, &VisToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
connect(visPath, &VisToolSplinePath::PathChanged, this, &DialogSplinePath::PathUpdated); connect(visPath, &VisToolSplinePath::PathChanged, this, &DialogSplinePath::PathUpdated);
} }
else else

View File

@ -261,6 +261,10 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
if (position == SplinePointPosition::FirstPoint) if (position == SplinePointPosition::FirstPoint)
{ {
QLineF line(spline.GetP1(), pos); QLineF line(spline.GetP1(), pos);
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
line.setAngle(VisLine::CorrectAngle(line.angle()));
}
qreal newAngle1 = line.angle(); qreal newAngle1 = line.angle();
QString newAngle1F = QString().setNum(newAngle1); QString newAngle1F = QString().setNum(newAngle1);
@ -287,6 +291,10 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
else else
{ {
QLineF line(spline.GetP4(), pos); QLineF line(spline.GetP4(), pos);
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
line.setAngle(VisLine::CorrectAngle(line.angle()));
}
qreal newAngle2 = line.angle(); qreal newAngle2 = line.angle();
QString newAngle2F = QString().setNum(newAngle2); QString newAngle2F = QString().setNum(newAngle2);

View File

@ -30,6 +30,7 @@
#define VABSTRACTSPLINE_H #define VABSTRACTSPLINE_H
#include "../vdrawtool.h" #include "../vdrawtool.h"
#include "visualization/line/visline.h"
#include <QGraphicsPathItem> #include <QGraphicsPathItem>

View File

@ -95,6 +95,8 @@ signals:
* @brief FullUpdateTree emit if need reparse pattern file. * @brief FullUpdateTree emit if need reparse pattern file.
*/ */
void LiteUpdateTree(const Document &parse); void LiteUpdateTree(const Document &parse);
void ToolTip(const QString &toolTip);
protected: protected:
/** @brief doc dom document container */ /** @brief doc dom document container */
VAbstractPattern *doc; VAbstractPattern *doc;
@ -166,6 +168,7 @@ inline void VAbstractTool::AddVisualization()
scene->addItem(visual); scene->addItem(visual);
vis = visual; vis = visual;
connect(vis, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);});
} }
#endif // VABSTRACTTOOL_H #endif // VABSTRACTTOOL_H

View File

@ -43,7 +43,7 @@ VisLine::~VisLine()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VisLine::CorrectAngle(const qreal &angle) const qreal VisLine::CorrectAngle(const qreal &angle)
{ {
qreal ang = angle; qreal ang = angle;
if (angle > 360) if (angle > 360)

View File

@ -44,8 +44,8 @@ public:
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::Line)}; enum { Type = UserType + static_cast<int>(Vis::Line)};
static qreal CorrectAngle(const qreal &angle);
protected: protected:
qreal CorrectAngle(const qreal &angle) const;
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const; QPointF Ray(const QPointF &firstPoint, const qreal &angle) const;
QPointF Ray(const QPointF &firstPoint) const; QPointF Ray(const QPointF &firstPoint) const;
QLineF Axis(const QPointF &p, const qreal &angle) const; QLineF Axis(const QPointF &p, const qreal &angle) const;

View File

@ -275,6 +275,11 @@ void VisToolCubicBezierPath::RefreshToolTip()
{ {
Visualization::toolTip = tr("<b>Curved path</b>: select more points for complete segment"); Visualization::toolTip = tr("<b>Curved path</b>: select more points for complete segment");
} }
if (mode == Mode::Show)
{
Visualization::toolTip = "";
}
emit ToolTip(Visualization::toolTip); emit ToolTip(Visualization::toolTip);
} }
} }

View File

@ -66,7 +66,9 @@ VisToolSpline::VisToolSpline(const VContainer *data, QGraphicsItem *parent)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VisToolSpline::~VisToolSpline() VisToolSpline::~VisToolSpline()
{} {
emit ToolTip("");
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolSpline::RefreshGeometry() void VisToolSpline::RefreshGeometry()
@ -150,6 +152,8 @@ void VisToolSpline::RefreshGeometry()
{ {
VSpline spline(*first, *second, angle1, angle2, kAsm1, kAsm2, kCurve); VSpline spline(*first, *second, angle1, angle2, kAsm1, kAsm2, kCurve);
DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap); DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
Visualization::toolTip = tr("Use <b>Shift</b> for sticking angle!");
emit ToolTip(Visualization::toolTip);
} }
} }
} }

View File

@ -48,6 +48,7 @@ VisToolSplinePath::~VisToolSplinePath()
{ {
qDeleteAll(ctrlPoints); qDeleteAll(ctrlPoints);
qDeleteAll(points); qDeleteAll(points);
emit ToolTip("");
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -99,6 +100,11 @@ void VisToolSplinePath::RefreshGeometry()
Visualization::toolTip = tr("<b>Curved path</b>: select three or more points, " Visualization::toolTip = tr("<b>Curved path</b>: select three or more points, "
"<b>Enter</b> - finish creation"); "<b>Enter</b> - finish creation");
} }
if (mode == Mode::Show)
{
Visualization::toolTip = tr("Use <b>Shift</b> for sticking angle!");
emit ToolTip(Visualization::toolTip);
}
} }
} }

View File

@ -0,0 +1,36 @@
/************************************************************************
**
** @file
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 19 7, 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 "vabstractmainwindow.h"
VAbstractMainWindow::VAbstractMainWindow(QWidget *parent) : QMainWindow(parent)
{}
//---------------------------------------------------------------------------------------------------------------------
VAbstractMainWindow::~VAbstractMainWindow()
{}

View File

@ -0,0 +1,45 @@
/************************************************************************
**
** @file
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 19 7, 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 VABSTRACTMAINWINDOW_H
#define VABSTRACTMAINWINDOW_H
#include <QMainWindow>
class VAbstractMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit VAbstractMainWindow(QWidget *parent = nullptr);
virtual ~VAbstractMainWindow() Q_DECL_OVERRIDE;
public slots:
virtual void ShowToolTip(const QString &toolTip)=0;
};
#endif // VABSTRACTMAINWINDOW_H

View File

@ -1,27 +1,29 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!! # ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro # This need for corect working file translations.pro
SOURCES += \ SOURCES += \
$$PWD/vmaingraphicsscene.cpp \ $$PWD/vmaingraphicsscene.cpp \
$$PWD/vmaingraphicsview.cpp \ $$PWD/vmaingraphicsview.cpp \
$$PWD/vwidgetpopup.cpp \ $$PWD/vwidgetpopup.cpp \
$$PWD/vcontrolpointspline.cpp \ $$PWD/vcontrolpointspline.cpp \
$$PWD/vgraphicssimpletextitem.cpp \ $$PWD/vgraphicssimpletextitem.cpp \
$$PWD/vsimplepoint.cpp \ $$PWD/vsimplepoint.cpp \
$$PWD/vabstractsimple.cpp \ $$PWD/vabstractsimple.cpp \
$$PWD/vnobrushscalepathitem.cpp \ $$PWD/vnobrushscalepathitem.cpp \
$$PWD/vsimplecurve.cpp $$PWD/vsimplecurve.cpp \
$$PWD/vabstractmainwindow.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
HEADERS += \
$$PWD/stable.h \ HEADERS += \
$$PWD/vmaingraphicsscene.h \ $$PWD/stable.h \
$$PWD/vmaingraphicsview.h \ $$PWD/vmaingraphicsscene.h \
$$PWD/vwidgetpopup.h \ $$PWD/vmaingraphicsview.h \
$$PWD/vcontrolpointspline.h \ $$PWD/vwidgetpopup.h \
$$PWD/vgraphicssimpletextitem.h \ $$PWD/vcontrolpointspline.h \
$$PWD/vsimplepoint.h \ $$PWD/vgraphicssimpletextitem.h \
$$PWD/vabstractsimple.h \ $$PWD/vsimplepoint.h \
$$PWD/vnobrushscalepathitem.h \ $$PWD/vabstractsimple.h \
$$PWD/vsimplecurve.h $$PWD/vnobrushscalepathitem.h \
$$PWD/vsimplecurve.h \
$$PWD/vabstractmainwindow.h

View File

@ -138,9 +138,11 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
{ {
QDir targetDir(tgtFilePath); QDir targetDir(tgtFilePath);
targetDir.cdUp(); targetDir.cdUp();
if (not targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) const QString dirName = QFileInfo(tgtFilePath).fileName();
if (not targetDir.mkdir(dirName))
{ {
QWARN("Can't create subdir./n"); const QString msg = QString("Can't create dir '%1'.").arg(dirName);
QWARN(qUtf8Printable(msg));
return false; return false;
} }
QDir sourceDir(srcFilePath); QDir sourceDir(srcFilePath);
@ -158,9 +160,37 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
} }
else else
{ {
if (not QFile::copy(srcFilePath, tgtFilePath)) if (QFileInfo(tgtFilePath).exists())
{ {
QWARN("Can't copy file./n"); const QString msg = QString("File '%1' exists.").arg(srcFilePath);
QWARN(qUtf8Printable(msg));
if (QFile::remove(tgtFilePath))
{
QWARN("File successfully removed.");
}
else
{
QWARN("Can't remove file.");
return false;
}
}
// Check error: Cannot open %file for input
QFile srcFile(srcFilePath);
if (not srcFile.open(QFile::ReadOnly))
{
const QString msg = QString("Can't copy file '%1'. Error: %2").arg(srcFilePath).arg(srcFile.errorString());
QWARN(qUtf8Printable(msg));
return false;
}
srcFile.close();
if (not srcFile.copy(tgtFilePath))
{
const QString msg = QString("Can't copy file '%1' to '%2'. Error: %3").arg(srcFilePath).arg(tgtFilePath)
.arg(srcFile.errorString());
QWARN(qUtf8Printable(msg));
return false; return false;
} }
} }