Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
01d1fc1b83
|
@ -15,7 +15,9 @@ DEPENDPATH += \
|
||||||
../src/libs/vobj \
|
../src/libs/vobj \
|
||||||
../src/libs/vlayout \
|
../src/libs/vlayout \
|
||||||
../src/libs/vgeometry \
|
../src/libs/vgeometry \
|
||||||
../src/libs/vpatterndb
|
../src/libs/vpatterndb \
|
||||||
|
../src/libs/vmisc \
|
||||||
|
../src/libs/vtools
|
||||||
|
|
||||||
include(../src/app/app.pri)
|
include(../src/app/app.pri)
|
||||||
include(../src/libs/qmuparser/qmuparser.pri)
|
include(../src/libs/qmuparser/qmuparser.pri)
|
||||||
|
@ -25,6 +27,8 @@ include(../src/libs/vobj/vobj.pri)
|
||||||
include(../src/libs/vlayout/vlayout.pri)
|
include(../src/libs/vlayout/vlayout.pri)
|
||||||
include(../src/libs/vgeometry/vgeometry.pri)
|
include(../src/libs/vgeometry/vgeometry.pri)
|
||||||
include(../src/libs/vpatterndb/vpatterndb.pri)
|
include(../src/libs/vpatterndb/vpatterndb.pri)
|
||||||
|
include(../src/libs/vmisc/vmisc.pri)
|
||||||
|
include(../src/libs/vtools/vtools.pri)
|
||||||
|
|
||||||
# Add here path to new translation file with name "valentina_*_*.ts" if you want to add new language.
|
# Add here path to new translation file with name "valentina_*_*.ts" if you want to add new language.
|
||||||
# Same paths in variable INSTALL_TRANSLATIONS (app.pro).
|
# Same paths in variable INSTALL_TRANSLATIONS (app.pro).
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
# Suport subdirectories. Just better project code tree.
|
# Suport subdirectories. Just better project code tree.
|
||||||
include(dialogs/dialogs.pri)
|
include(dialogs/dialogs.pri)
|
||||||
include(tools/tools.pri)
|
|
||||||
include(widgets/widgets.pri)
|
|
||||||
include(xml/xml.pri)
|
include(xml/xml.pri)
|
||||||
include(undocommands/undocommands.pri)
|
|
||||||
include(visualization/visualization.pri)
|
|
||||||
include(core/core.pri)
|
include(core/core.pri)
|
||||||
|
|
||||||
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
|
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
|
||||||
|
|
|
@ -46,10 +46,6 @@ UI_DIR = uic
|
||||||
|
|
||||||
# Suport subdirectories. Just better project code tree.
|
# Suport subdirectories. Just better project code tree.
|
||||||
include(app.pri)
|
include(app.pri)
|
||||||
include(../utils/utils.pri)
|
|
||||||
|
|
||||||
# This include path help promoute VMainGraphicsView on main window. Without it compiler can't find path to custom view
|
|
||||||
INCLUDEPATH += "$${PWD}/widgets"
|
|
||||||
|
|
||||||
# Resource files. This files will be included in binary.
|
# Resource files. This files will be included in binary.
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
|
@ -87,6 +83,7 @@ CONFIG(debug, debug|release){
|
||||||
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
||||||
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
||||||
|
-isystem "$${OUT_PWD}/../libs/vtools/$${UI_DIR}" \ # For VTools UI files
|
||||||
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
||||||
|
|
||||||
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
|
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
|
||||||
|
@ -105,6 +102,7 @@ CONFIG(debug, debug|release){
|
||||||
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
||||||
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
||||||
|
-isystem "$${OUT_PWD}/../libs/vtools/$${UI_DIR}" \ # For VTools UI files
|
||||||
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
||||||
|
|
||||||
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
|
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
|
||||||
|
@ -564,6 +562,27 @@ else:unix: LIBS += -L$${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR} -lvproper
|
||||||
INCLUDEPATH += $${PWD}/../libs/vpropertyexplorer
|
INCLUDEPATH += $${PWD}/../libs/vpropertyexplorer
|
||||||
DEPENDPATH += $${PWD}/../libs/vpropertyexplorer
|
DEPENDPATH += $${PWD}/../libs/vpropertyexplorer
|
||||||
|
|
||||||
|
# When the GNU linker sees a library, it discards all symbols that it doesn't need.
|
||||||
|
# Add dependent library the first.
|
||||||
|
|
||||||
|
#VPatternDB static library (depend on vgeometry)
|
||||||
|
unix|win32: LIBS += -L$$OUT_PWD/../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../libs/vpatterndb
|
||||||
|
DEPENDPATH += $$PWD/../libs/vpatterndb
|
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
||||||
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
||||||
|
|
||||||
|
# VGeometry static library (depend on ifc)
|
||||||
|
unix|win32: LIBS += -L$$OUT_PWD/../libs/vgeometry/$${DESTDIR}/ -lvgeometry
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../libs/vgeometry
|
||||||
|
DEPENDPATH += $$PWD/../libs/vgeometry
|
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vgeometry/$${DESTDIR}/vgeometry.lib
|
||||||
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vgeometry/$${DESTDIR}/libvgeometry.a
|
||||||
|
|
||||||
# IFC static library
|
# IFC static library
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../libs/ifc/$${DESTDIR}/ -lifc
|
unix|win32: LIBS += -L$$OUT_PWD/../libs/ifc/$${DESTDIR}/ -lifc
|
||||||
|
|
||||||
|
@ -591,23 +610,33 @@ DEPENDPATH += $$PWD/../libs/vlayout
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vlayout/$${DESTDIR}/vlayout.lib
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vlayout/$${DESTDIR}/vlayout.lib
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vlayout/$${DESTDIR}/libvlayout.a
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vlayout/$${DESTDIR}/libvlayout.a
|
||||||
|
|
||||||
# VGeometry static library
|
#VTools static library (depend on vwidgets and vmisc)
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../libs/vgeometry/$${DESTDIR}/ -lvgeometry
|
unix|win32: LIBS += -L$$OUT_PWD/../libs/vtools/$${DESTDIR}/ -lvtools
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../libs/vgeometry
|
INCLUDEPATH += $$PWD/../libs/vtools
|
||||||
DEPENDPATH += $$PWD/../libs/vgeometry
|
INCLUDEPATH += $$OUT_PWD/../libs/vtools/$${UI_DIR} # For UI files
|
||||||
|
DEPENDPATH += $$PWD/../libs/vtools
|
||||||
|
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vgeometry/$${DESTDIR}/vgeometry.lib
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vtools/$${DESTDIR}/vtools.lib
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vgeometry/$${DESTDIR}/libvgeometry.a
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vtools/$${DESTDIR}/libvtools.a
|
||||||
|
|
||||||
#VPatternDB staic library
|
#VMisc static library
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../libs/vpatterndb/$${DESTDIR}/ -lvpatterndb
|
unix|win32: LIBS += -L$$OUT_PWD/../libs/vmisc/$${DESTDIR}/ -lvmisc
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../libs/vpatterndb
|
INCLUDEPATH += $$PWD/../libs/vmisc
|
||||||
DEPENDPATH += $$PWD/../libs/vpatterndb
|
DEPENDPATH += $$PWD/../libs/vmisc
|
||||||
|
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vmisc/$${DESTDIR}/vmisc.lib
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vmisc/$${DESTDIR}/libvmisc.a
|
||||||
|
|
||||||
|
#VWidgets static library
|
||||||
|
unix|win32: LIBS += -L$$OUT_PWD/../libs/vwidgets/$${DESTDIR}/ -lvwidgets
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../libs/vwidgets
|
||||||
|
DEPENDPATH += $$PWD/../libs/vwidgets
|
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vwidgets/$${DESTDIR}/vwidgets.lib
|
||||||
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vwidgets/$${DESTDIR}/libvwidgets.a
|
||||||
|
|
||||||
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
|
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
|
@ -3,16 +3,12 @@
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/vapplication.h \
|
$$PWD/vapplication.h \
|
||||||
$$PWD/undoevent.h \
|
$$PWD/vformulaproperty.h \
|
||||||
$$PWD/vsettings.h \
|
$$PWD/vformulapropertyeditor.h \
|
||||||
$$PWD/backport/qcommandlineoption.h \
|
$$PWD/vtooloptionspropertybrowser.h
|
||||||
$$PWD/backport/qcommandlineparser.h \
|
|
||||||
$$PWD/vformula.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/vapplication.cpp \
|
$$PWD/vapplication.cpp \
|
||||||
$$PWD/undoevent.cpp \
|
$$PWD/vformulaproperty.cpp \
|
||||||
$$PWD/vsettings.cpp \
|
$$PWD/vformulapropertyeditor.cpp \
|
||||||
$$PWD/backport/qcommandlineoption.cpp \
|
$$PWD/vtooloptionspropertybrowser.cpp
|
||||||
$$PWD/backport/qcommandlineparser.cpp \
|
|
||||||
$$PWD/vformula.cpp
|
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
#include "../libs/ifc/exception/vexceptionconversionerror.h"
|
#include "../libs/ifc/exception/vexceptionconversionerror.h"
|
||||||
#include "../libs/ifc/exception/vexceptionemptyparameter.h"
|
#include "../libs/ifc/exception/vexceptionemptyparameter.h"
|
||||||
#include "../libs/ifc/exception/vexceptionwrongid.h"
|
#include "../libs/ifc/exception/vexceptionwrongid.h"
|
||||||
#include "vmaingraphicsview.h"
|
#include "../libs/vwidgets/vmaingraphicsview.h"
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "../../utils/logging.h"
|
#include "../vmisc/logging.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -156,10 +156,9 @@ const QString VApplication::GistFileName = QStringLiteral("gist.json");
|
||||||
* @param argv command line.
|
* @param argv command line.
|
||||||
*/
|
*/
|
||||||
VApplication::VApplication(int &argc, char **argv)
|
VApplication::VApplication(int &argc, char **argv)
|
||||||
: QApplication(argc, argv), _patternUnit(Unit::Cm), _patternType(MeasurementsType::Individual),
|
: VAbstractApplication(argc, argv),
|
||||||
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), trVars(nullptr),
|
trVars(nullptr), autoSaveTimer(nullptr),
|
||||||
undoStack(nullptr), sceneView(nullptr), currentScene(nullptr), autoSaveTimer(nullptr), mainWindow(nullptr),
|
log(nullptr),
|
||||||
openingPattern(false), settings(nullptr), doc(nullptr), log(nullptr),
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
out(nullptr), logLock(nullptr)
|
out(nullptr), logLock(nullptr)
|
||||||
#else
|
#else
|
||||||
|
@ -167,8 +166,6 @@ VApplication::VApplication(int &argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
undoStack = new QUndoStack(this);
|
undoStack = new QUndoStack(this);
|
||||||
|
|
||||||
InitLineWidth();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -226,15 +223,6 @@ void VApplication::NewValentina(const QString &fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::CheckFactor(qreal &oldFactor, const qreal &Newfactor)
|
|
||||||
{
|
|
||||||
if (Newfactor <= 2 && Newfactor >= 0.5)
|
|
||||||
{
|
|
||||||
oldFactor = Newfactor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief notify Reimplemented from QApplication::notify().
|
* @brief notify Reimplemented from QApplication::notify().
|
||||||
|
@ -349,27 +337,6 @@ QString VApplication::translationsPath() const
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::InitLineWidth()
|
|
||||||
{
|
|
||||||
switch (_patternUnit)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
_widthMainLine = DefWidth;
|
|
||||||
break;
|
|
||||||
case Unit::Cm:
|
|
||||||
_widthMainLine = DefWidth/10.0;
|
|
||||||
break;
|
|
||||||
case Unit::Inch:
|
|
||||||
_widthMainLine = DefWidth/25.4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_widthMainLine = DefWidth;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_widthHairLine = _widthMainLine/3.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VApplication::LogDirPath() const
|
QString VApplication::LogDirPath() const
|
||||||
{
|
{
|
||||||
|
@ -489,13 +456,6 @@ void VApplication::ClearOldLogs() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::setPatternUnit(const Unit &patternUnit)
|
|
||||||
{
|
|
||||||
_patternUnit = patternUnit;
|
|
||||||
InitLineWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VApplication::InitOptions()
|
void VApplication::InitOptions()
|
||||||
{
|
{
|
||||||
|
@ -524,7 +484,7 @@ void VApplication::InitOptions()
|
||||||
qDebug()<<"Command-line arguments:"<<this->arguments();
|
qDebug()<<"Command-line arguments:"<<this->arguments();
|
||||||
qDebug()<<"Process ID:"<<this->applicationPid();
|
qDebug()<<"Process ID:"<<this->applicationPid();
|
||||||
|
|
||||||
const QString checkedLocale = getSettings()->GetLocale();
|
const QString checkedLocale = Settings()->GetLocale();
|
||||||
qDebug()<<"Checked locale:"<<checkedLocale;
|
qDebug()<<"Checked locale:"<<checkedLocale;
|
||||||
|
|
||||||
QTranslator *qtTranslator = new QTranslator(this);
|
QTranslator *qtTranslator = new QTranslator(this);
|
||||||
|
@ -560,121 +520,6 @@ void VApplication::InitOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
double VApplication::toPixel(double val) const
|
|
||||||
{
|
|
||||||
return ToPixel(val, _patternUnit);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
double VApplication::fromPixel(double pix) const
|
|
||||||
{
|
|
||||||
return FromPixel(pix, _patternUnit);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QWidget *VApplication::getMainWindow() const
|
|
||||||
{
|
|
||||||
return mainWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::setMainWindow(QWidget *value)
|
|
||||||
{
|
|
||||||
SCASSERT(value != nullptr)
|
|
||||||
mainWindow = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool VApplication::getOpeningPattern() const
|
|
||||||
{
|
|
||||||
return openingPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::setOpeningPattern()
|
|
||||||
{
|
|
||||||
openingPattern = !openingPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief VApplication::OpenSettings get acsses to application settings.
|
|
||||||
*
|
|
||||||
* Because we can create object in constructor we open file separately.
|
|
||||||
*/
|
|
||||||
void VApplication::OpenSettings()
|
|
||||||
{
|
|
||||||
settings = new VSettings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief VApplication::getSettings hide settings constructor.
|
|
||||||
* @return pointer to class for acssesing to settings in ini file.
|
|
||||||
*/
|
|
||||||
VSettings *VApplication::getSettings()
|
|
||||||
{
|
|
||||||
SCASSERT(settings != nullptr);
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGraphicsScene *VApplication::getCurrentScene() const
|
|
||||||
{
|
|
||||||
SCASSERT(currentScene != nullptr);
|
|
||||||
return currentScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::setCurrentScene(QGraphicsScene *value)
|
|
||||||
{
|
|
||||||
currentScene = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::setOverrideCursor(const QString &pixmapPath, int hotX, int hotY)
|
|
||||||
{
|
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QPixmap oldPixmap;
|
|
||||||
if (QCursor *oldCursor = QGuiApplication::overrideCursor())
|
|
||||||
{
|
|
||||||
oldPixmap = oldCursor->pixmap();
|
|
||||||
}
|
|
||||||
QPixmap newPixmap(pixmapPath);
|
|
||||||
|
|
||||||
QImage oldImage = oldPixmap.toImage();
|
|
||||||
QImage newImage = newPixmap.toImage();
|
|
||||||
|
|
||||||
if (oldImage != newImage )
|
|
||||||
{
|
|
||||||
QApplication::setOverrideCursor(QCursor(newPixmap, hotX, hotY));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::restoreOverrideCursor(const QString &pixmapPath)
|
|
||||||
{
|
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QPixmap oldPixmap;
|
|
||||||
if (QCursor *oldCursor = QGuiApplication::overrideCursor())
|
|
||||||
{
|
|
||||||
oldPixmap = oldCursor->pixmap();
|
|
||||||
}
|
|
||||||
QPixmap newPixmap(pixmapPath);
|
|
||||||
|
|
||||||
QImage oldImage = oldPixmap.toImage();
|
|
||||||
QImage newImage = newPixmap.toImage();
|
|
||||||
|
|
||||||
if (oldImage == newImage )
|
|
||||||
{
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VApplication::LabelLanguages()
|
QStringList VApplication::LabelLanguages()
|
||||||
{
|
{
|
||||||
|
@ -731,7 +576,7 @@ const VTranslateVars *VApplication::TrVars()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VApplication::InitTrVars()
|
void VApplication::InitTrVars()
|
||||||
{
|
{
|
||||||
trVars = new VTranslateVars(getSettings());
|
trVars = new VTranslateVars(Settings());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||||
|
|
|
@ -29,14 +29,13 @@
|
||||||
#ifndef VAPPLICATION_H
|
#ifndef VAPPLICATION_H
|
||||||
#define VAPPLICATION_H
|
#define VAPPLICATION_H
|
||||||
|
|
||||||
#include <QApplication>
|
#include "../libs/vmisc/vabstractapplication.h"
|
||||||
#include "../options.h"
|
#include "../options.h"
|
||||||
#include "../widgets/vmaingraphicsview.h"
|
#include "../libs/vwidgets/vmaingraphicsview.h"
|
||||||
#include "../libs/vpatterndb/vtranslatevars.h"
|
#include "../libs/vpatterndb/vtranslatevars.h"
|
||||||
#include "vsettings.h"
|
#include "vsettings.h"
|
||||||
|
|
||||||
class VApplication;// used in define
|
class VApplication;// use in define
|
||||||
class QUndoStack;
|
|
||||||
class VMainGraphicsView;
|
class VMainGraphicsView;
|
||||||
class VPattern;
|
class VPattern;
|
||||||
class QFile;
|
class QFile;
|
||||||
|
@ -47,78 +46,39 @@ class QLockFile;
|
||||||
#if defined(qApp)
|
#if defined(qApp)
|
||||||
#undef qApp
|
#undef qApp
|
||||||
#endif
|
#endif
|
||||||
#define qApp (static_cast<VApplication*>(QCoreApplication::instance()))
|
#define qApp (static_cast<VApplication*>(VAbstractApplication::instance()))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VApplication class reimplamentation QApplication class.
|
* @brief The VApplication class reimplamentation QApplication class.
|
||||||
*/
|
*/
|
||||||
class VApplication : public QApplication
|
class VApplication : public VAbstractApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VApplication(int &argc, char ** argv);
|
VApplication(int &argc, char ** argv);
|
||||||
virtual ~VApplication();
|
virtual ~VApplication();
|
||||||
static void NewValentina(const QString &fileName = QString());
|
static void NewValentina(const QString &fileName = QString());
|
||||||
static void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
|
|
||||||
virtual bool notify(QObject * receiver, QEvent * event);
|
virtual bool notify(QObject * receiver, QEvent * event);
|
||||||
Unit patternUnit() const;
|
|
||||||
const Unit *patternUnitP() const;
|
|
||||||
void setPatternUnit(const Unit &patternUnit);
|
|
||||||
MeasurementsType patternType() const;
|
|
||||||
void setPatternType(const MeasurementsType &patternType);
|
|
||||||
|
|
||||||
void InitOptions();
|
void InitOptions();
|
||||||
|
|
||||||
double toPixel(double val) const;
|
|
||||||
double fromPixel(double pix) const;
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
static bool TryLock(QLockFile *lock);
|
static bool TryLock(QLockFile *lock);
|
||||||
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
|
|
||||||
QString translationsPath() const;
|
QString translationsPath() const;
|
||||||
qreal widthMainLine() const;
|
|
||||||
qreal widthHairLine() const;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
QString LocaleToString(const T &value)
|
|
||||||
{
|
|
||||||
QLocale loc;
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
|
|
||||||
return loc.toString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
QUndoStack *getUndoStack() const;
|
|
||||||
VMainGraphicsView *getSceneView() const;
|
|
||||||
void setSceneView(VMainGraphicsView *value);
|
|
||||||
QTimer *getAutoSaveTimer() const;
|
QTimer *getAutoSaveTimer() const;
|
||||||
void setAutoSaveTimer(QTimer *value);
|
void setAutoSaveTimer(QTimer *value);
|
||||||
QWidget *getMainWindow() const;
|
|
||||||
void setMainWindow(QWidget *value);
|
|
||||||
bool getOpeningPattern() const;
|
|
||||||
void setOpeningPattern();
|
|
||||||
|
|
||||||
void OpenSettings();
|
|
||||||
VSettings *getSettings();
|
|
||||||
|
|
||||||
QGraphicsScene *getCurrentScene() const;
|
|
||||||
void setCurrentScene(QGraphicsScene *value);
|
|
||||||
|
|
||||||
void setCurrentDocument(VPattern *doc);
|
|
||||||
VPattern *getCurrentDocument()const;
|
|
||||||
|
|
||||||
static void setOverrideCursor(const QString & pixmapPath, int hotX = -1, int hotY = -1);
|
|
||||||
static void restoreOverrideCursor(const QString & pixmapPath);
|
|
||||||
|
|
||||||
static QStringList LabelLanguages();
|
static QStringList LabelLanguages();
|
||||||
|
|
||||||
void StartLogging();
|
void StartLogging();
|
||||||
QTextStream *LogFile();
|
QTextStream *LogFile();
|
||||||
|
|
||||||
const VTranslateVars *TrVars();
|
virtual const VTranslateVars *TrVars();
|
||||||
void InitTrVars();
|
void InitTrVars();
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||||
static void DrMingw();
|
static void DrMingw();
|
||||||
void CollectReports() const;
|
void CollectReports() const;
|
||||||
|
@ -131,31 +91,9 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VApplication)
|
Q_DISABLE_COPY(VApplication)
|
||||||
Unit _patternUnit;
|
|
||||||
MeasurementsType _patternType;
|
|
||||||
qreal _widthMainLine;
|
|
||||||
qreal _widthHairLine;
|
|
||||||
VTranslateVars *trVars;
|
VTranslateVars *trVars;
|
||||||
QUndoStack *undoStack;
|
|
||||||
VMainGraphicsView *sceneView;
|
|
||||||
QGraphicsScene *currentScene;
|
|
||||||
QTimer *autoSaveTimer;
|
QTimer *autoSaveTimer;
|
||||||
/**
|
|
||||||
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
|
||||||
* modality doesn't work.
|
|
||||||
*/
|
|
||||||
QWidget *mainWindow;
|
|
||||||
/**
|
|
||||||
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
|
|
||||||
* we can allow user use Undo option.
|
|
||||||
*/
|
|
||||||
bool openingPattern;
|
|
||||||
/**
|
|
||||||
* @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable.
|
|
||||||
*/
|
|
||||||
VSettings *settings;
|
|
||||||
|
|
||||||
VPattern *doc;
|
|
||||||
QFile *log;
|
QFile *log;
|
||||||
QTextStream *out;
|
QTextStream *out;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
|
@ -180,60 +118,6 @@ private:
|
||||||
void ClearOldLogs()const;
|
void ClearOldLogs()const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline Unit VApplication::patternUnit() const
|
|
||||||
{
|
|
||||||
return _patternUnit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline const Unit *VApplication::patternUnitP() const
|
|
||||||
{
|
|
||||||
return &_patternUnit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline MeasurementsType VApplication::patternType() const
|
|
||||||
{
|
|
||||||
return _patternType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline void VApplication::setPatternType(const MeasurementsType &patternType)
|
|
||||||
{
|
|
||||||
_patternType = patternType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline qreal VApplication::widthMainLine() const
|
|
||||||
{
|
|
||||||
return _widthMainLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline qreal VApplication::widthHairLine() const
|
|
||||||
{
|
|
||||||
return _widthHairLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline QUndoStack *VApplication::getUndoStack() const
|
|
||||||
{
|
|
||||||
return undoStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline VMainGraphicsView *VApplication::getSceneView() const
|
|
||||||
{
|
|
||||||
return sceneView;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline void VApplication::setSceneView(VMainGraphicsView *value)
|
|
||||||
{
|
|
||||||
sceneView = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QTimer *VApplication::getAutoSaveTimer() const
|
inline QTimer *VApplication::getAutoSaveTimer() const
|
||||||
{
|
{
|
||||||
|
@ -246,17 +130,4 @@ inline void VApplication::setAutoSaveTimer(QTimer *value)
|
||||||
autoSaveTimer = value;
|
autoSaveTimer = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline void VApplication::setCurrentDocument(VPattern *doc)
|
|
||||||
{
|
|
||||||
this->doc = doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline VPattern *VApplication::getCurrentDocument() const
|
|
||||||
{
|
|
||||||
SCASSERT(doc != nullptr)
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VAPPLICATION_H
|
#endif // VAPPLICATION_H
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "../../libs/vpropertyexplorer/vproperty_p.h"
|
#include "../../libs/vpropertyexplorer/vproperty_p.h"
|
||||||
#include "vformulapropertyeditor.h"
|
#include "vformulapropertyeditor.h"
|
||||||
#include "../../libs/vpropertyexplorer/vproperties.h"
|
#include "../../libs/vpropertyexplorer/vproperties.h"
|
||||||
#include "../core/vformula.h"
|
#include "../../libs/vpatterndb/vformula.h"
|
||||||
|
|
||||||
enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2};
|
enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2};
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
|
||||||
#include "../../libs/vpropertyexplorer/vproperty.h"
|
#include "../../libs/vpropertyexplorer/vproperty.h"
|
||||||
#include "../dialogs/tools/dialogeditwrongformula.h"
|
#include "../../libs/vtools/dialogs/support/dialogeditwrongformula.h"
|
||||||
|
|
||||||
using namespace VPE;
|
using namespace VPE;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSpacerItem>
|
#include <QSpacerItem>
|
||||||
|
|
||||||
#include "../core/vformula.h"
|
#include "../../libs/vpatterndb/vformula.h"
|
||||||
|
|
||||||
class VFormulaPropertyEditor : public QWidget
|
class VFormulaPropertyEditor : public QWidget
|
||||||
{
|
{
|
|
@ -27,14 +27,14 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vtooloptionspropertybrowser.h"
|
#include "vtooloptionspropertybrowser.h"
|
||||||
#include "../tools/drawTools/drawtools.h"
|
#include "../../libs/vtools/tools/drawTools/drawtools.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../core/vapplication.h"
|
||||||
#include "vmaingraphicsview.h"
|
#include "../../libs/vwidgets/vmaingraphicsview.h"
|
||||||
#include "../visualization/vgraphicssimpletextitem.h"
|
#include "../../libs/vwidgets/vgraphicssimpletextitem.h"
|
||||||
#include "../visualization/vcontrolpointspline.h"
|
#include "../../libs/vwidgets/vcontrolpointspline.h"
|
||||||
#include "../../libs/vpropertyexplorer/vproperties.h"
|
#include "../../libs/vpropertyexplorer/vproperties.h"
|
||||||
#include "vformulaproperty.h"
|
#include "vformulaproperty.h"
|
||||||
#include "../core/vformula.h"
|
#include "../../libs/vpatterndb/vformula.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
|
@ -33,7 +33,7 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include "../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent) :
|
ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
|
@ -93,7 +93,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
setWindowTitle(tr("Config Dialog"));
|
setWindowTitle(tr("Config Dialog"));
|
||||||
|
|
||||||
this->setFixedSize(QSize(750, 550));
|
this->setFixedSize(QSize(750, 550));
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -157,7 +157,7 @@ void ConfigDialog::Apply()
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
emit UpdateProperties();
|
emit UpdateProperties();
|
||||||
setResult(QDialog::Accepted);
|
setResult(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "communitypage.h"
|
#include "communitypage.h"
|
||||||
#include "../../../options.h"
|
#include "../../../options.h"
|
||||||
#include "../../../core/vapplication.h"
|
#include "../../../core/vapplication.h"
|
||||||
#include "../../../core/vsettings.h"
|
#include "../../../../libs/vmisc/vsettings.h"
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
@ -58,17 +58,17 @@ CommunityPage::CommunityPage(QWidget *parent):
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void CommunityPage::Apply()
|
void CommunityPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->getSettings()->SetServer(this->server->text());
|
qApp->Settings()->SetServer(this->server->text());
|
||||||
qApp->getSettings()->SetServerSecure(this->secureComm->isChecked());
|
qApp->Settings()->SetServerSecure(this->secureComm->isChecked());
|
||||||
qApp->getSettings()->SetProxy(this->useProxy->isChecked());
|
qApp->Settings()->SetProxy(this->useProxy->isChecked());
|
||||||
qApp->getSettings()->SetProxyAddress(this->proxyAddress->text());
|
qApp->Settings()->SetProxyAddress(this->proxyAddress->text());
|
||||||
qApp->getSettings()->SetProxyPort(this->proxyPort->text());
|
qApp->Settings()->SetProxyPort(this->proxyPort->text());
|
||||||
qApp->getSettings()->SetProxyUser(this->proxyUser->text());
|
qApp->Settings()->SetProxyUser(this->proxyUser->text());
|
||||||
qApp->getSettings()->SetProxyPass(this->proxyPass->text());
|
qApp->Settings()->SetProxyPass(this->proxyPass->text());
|
||||||
|
|
||||||
qApp->getSettings()->SetUsername(this->username->text());
|
qApp->Settings()->SetUsername(this->username->text());
|
||||||
qApp->getSettings()->SetSavePassword(this->savePassword->isChecked());
|
qApp->Settings()->SetSavePassword(this->savePassword->isChecked());
|
||||||
qApp->getSettings()->SetUserPassword(this->userpassword->text());
|
qApp->Settings()->SetUserPassword(this->userpassword->text());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ QGroupBox *CommunityPage::ServerGroup()
|
||||||
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
||||||
QFormLayout *serverLayout = new QFormLayout;
|
QFormLayout *serverLayout = new QFormLayout;
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->getSettings()->GetServer(), tr("Server name/IP"));
|
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->Settings()->GetServer(), tr("Server name/IP"));
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->getSettings()->GetServerSecure(),
|
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->Settings()->GetServerSecure(),
|
||||||
tr("Secure connection"));
|
tr("Secure connection"));
|
||||||
|
|
||||||
ServerGroup->setLayout(serverLayout);
|
ServerGroup->setLayout(serverLayout);
|
||||||
|
@ -137,12 +137,12 @@ QGroupBox *CommunityPage::ProxyGroup()
|
||||||
|
|
||||||
QFormLayout *proxyLayout = new QFormLayout;
|
QFormLayout *proxyLayout = new QFormLayout;
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->getSettings()->GetProxy(), tr("Use Proxy"));
|
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->Settings()->GetProxy(), tr("Use Proxy"));
|
||||||
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->getSettings()->GetProxyAddress(),
|
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->Settings()->GetProxyAddress(),
|
||||||
tr("Proxy address"));
|
tr("Proxy address"));
|
||||||
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->getSettings()->GetProxyPort(), tr("Proxy port"));
|
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->Settings()->GetProxyPort(), tr("Proxy port"));
|
||||||
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->getSettings()->GetProxyUser(), tr("Proxy user"));
|
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->Settings()->GetProxyUser(), tr("Proxy user"));
|
||||||
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->getSettings()->GetProxyPass(), tr("Proxy pass"));
|
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->Settings()->GetProxyPass(), tr("Proxy pass"));
|
||||||
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
||||||
this->ProxyCheckChanged();
|
this->ProxyCheckChanged();
|
||||||
|
|
||||||
|
@ -157,10 +157,10 @@ QGroupBox *CommunityPage::UserGroup()
|
||||||
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
||||||
QFormLayout *userLayout = new QFormLayout;
|
QFormLayout *userLayout = new QFormLayout;
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->username, userLayout, qApp->getSettings()->GetUsername(), tr("User Name"));
|
CommunityPage::add_lineedit(&this->username, userLayout, qApp->Settings()->GetUsername(), tr("User Name"));
|
||||||
CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->getSettings()->GetSavePassword(),
|
CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->Settings()->GetSavePassword(),
|
||||||
tr("Save password"));
|
tr("Save password"));
|
||||||
CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->getSettings()->GetUserPassword(),
|
CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->Settings()->GetUserPassword(),
|
||||||
tr("Password"));
|
tr("Password"));
|
||||||
|
|
||||||
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "configurationpage.h"
|
#include "configurationpage.h"
|
||||||
#include "../../../options.h"
|
#include "../../../options.h"
|
||||||
#include "../../../core/vapplication.h"
|
#include "../../../core/vapplication.h"
|
||||||
#include "../../../core/vsettings.h"
|
#include "../../../../libs/vmisc/vsettings.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -67,23 +67,23 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void ConfigurationPage::Apply()
|
void ConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->getSettings()->SetAutosaveState(autoSaveCheck->isChecked());
|
qApp->Settings()->SetAutosaveState(autoSaveCheck->isChecked());
|
||||||
qApp->getSettings()->SetAutosaveTime(autoTime->value());
|
qApp->Settings()->SetAutosaveTime(autoTime->value());
|
||||||
|
|
||||||
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
||||||
SCASSERT(autoSaveTimer);
|
SCASSERT(autoSaveTimer);
|
||||||
|
|
||||||
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();
|
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();
|
||||||
|
|
||||||
qApp->getSettings()->SetOsSeparator(osOptionCheck->isChecked());
|
qApp->Settings()->SetOsSeparator(osOptionCheck->isChecked());
|
||||||
qApp->getSettings()->SetSendReportState(sendReportCheck->isChecked());
|
qApp->Settings()->SetSendReportState(sendReportCheck->isChecked());
|
||||||
qApp->getSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
|
qApp->Settings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
|
||||||
qApp->getSettings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
|
qApp->Settings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
|
||||||
|
|
||||||
if (langChanged)
|
if (langChanged)
|
||||||
{
|
{
|
||||||
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
||||||
qApp->getSettings()->SetLocale(locale);
|
qApp->Settings()->SetLocale(locale);
|
||||||
langChanged = false;
|
langChanged = false;
|
||||||
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
|
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
|
||||||
QApplication::applicationName();
|
QApplication::applicationName();
|
||||||
|
@ -92,7 +92,7 @@ void ConfigurationPage::Apply()
|
||||||
if (this->unitChanged)
|
if (this->unitChanged)
|
||||||
{
|
{
|
||||||
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
||||||
qApp->getSettings()->SetUnit(unit);
|
qApp->Settings()->SetUnit(unit);
|
||||||
this->unitChanged = false;
|
this->unitChanged = false;
|
||||||
const QString text = tr("Default unit updated and will be used the next pattern creation");
|
const QString text = tr("Default unit updated and will be used the next pattern creation");
|
||||||
QMessageBox::information(this, QApplication::applicationName(), text);
|
QMessageBox::information(this, QApplication::applicationName(), text);
|
||||||
|
@ -100,7 +100,7 @@ void ConfigurationPage::Apply()
|
||||||
if (labelLangChanged)
|
if (labelLangChanged)
|
||||||
{
|
{
|
||||||
const QString locale = qvariant_cast<QString>(labelCombo->itemData(labelCombo->currentIndex()));
|
const QString locale = qvariant_cast<QString>(labelCombo->itemData(labelCombo->currentIndex()));
|
||||||
qApp->getSettings()->SetLabelLanguage(locale);
|
qApp->Settings()->SetLabelLanguage(locale);
|
||||||
labelLangChanged = false;
|
labelLangChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,11 +129,11 @@ QGroupBox *ConfigurationPage::SaveGroup()
|
||||||
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
||||||
|
|
||||||
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
||||||
autoSaveCheck->setChecked(qApp->getSettings()->GetAutosaveState());
|
autoSaveCheck->setChecked(qApp->Settings()->GetAutosaveState());
|
||||||
|
|
||||||
autoTime = new QSpinBox();
|
autoTime = new QSpinBox();
|
||||||
autoTime->setRange(1, 60);
|
autoTime->setRange(1, 60);
|
||||||
autoTime->setValue(qApp->getSettings()->GetAutosaveTime());
|
autoTime->setValue(qApp->Settings()->GetAutosaveTime());
|
||||||
autoTime->setSuffix(tr("min"));
|
autoTime->setSuffix(tr("min"));
|
||||||
|
|
||||||
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
||||||
|
@ -181,7 +181,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default translators and language checked
|
// set default translators and language checked
|
||||||
qint32 index = langCombo->findData(qApp->getSettings()->GetLocale());
|
qint32 index = langCombo->findData(qApp->Settings()->GetLocale());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
langCombo->setCurrentIndex(index);
|
langCombo->setCurrentIndex(index);
|
||||||
|
@ -197,7 +197,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
||||||
|
|
||||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||||
osOptionCheck->setChecked(qApp->getSettings()->GetOsSeparator());
|
osOptionCheck->setChecked(qApp->Settings()->GetOsSeparator());
|
||||||
|
|
||||||
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
||||||
separatorLayout->addWidget(separatorLabel);
|
separatorLayout->addWidget(separatorLabel);
|
||||||
|
@ -212,7 +212,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
this->unitCombo->addItem(tr("Inches"), "in");
|
this->unitCombo->addItem(tr("Inches"), "in");
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
qint32 indexUnit = this->unitCombo->findData(qApp->getSettings()->GetUnit());
|
qint32 indexUnit = this->unitCombo->findData(qApp->Settings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
this->unitCombo->setCurrentIndex(indexUnit);
|
this->unitCombo->setCurrentIndex(indexUnit);
|
||||||
|
@ -231,7 +231,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
|
|
||||||
SetLabelComboBox(VApplication::LabelLanguages());
|
SetLabelComboBox(VApplication::LabelLanguages());
|
||||||
|
|
||||||
index = labelCombo->findData(qApp->getSettings()->GetLabelLanguage());
|
index = labelCombo->findData(qApp->Settings()->GetLabelLanguage());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
labelCombo->setCurrentIndex(index);
|
labelCombo->setCurrentIndex(index);
|
||||||
|
@ -261,7 +261,7 @@ QGroupBox *ConfigurationPage::SendGroup()
|
||||||
QGroupBox *sendGroup = new QGroupBox(tr("Send crash reports"));
|
QGroupBox *sendGroup = new QGroupBox(tr("Send crash reports"));
|
||||||
|
|
||||||
sendReportCheck = new QCheckBox(tr("Send crash reports (recommended)"));
|
sendReportCheck = new QCheckBox(tr("Send crash reports (recommended)"));
|
||||||
sendReportCheck->setChecked(qApp->getSettings()->GetSendReportState());
|
sendReportCheck->setChecked(qApp->Settings()->GetSendReportState());
|
||||||
|
|
||||||
QLabel *description = new QLabel(tr("After each crash Valentina collect information that may help us fix a "
|
QLabel *description = new QLabel(tr("After each crash Valentina collect information that may help us fix a "
|
||||||
"problem. We do not collect any personal information. Find more about what "
|
"problem. We do not collect any personal information. Find more about what "
|
||||||
|
@ -286,7 +286,7 @@ QGroupBox *ConfigurationPage::DrawGroup()
|
||||||
QGroupBox *drawGroup = new QGroupBox(tr("Pattern Editing"));
|
QGroupBox *drawGroup = new QGroupBox(tr("Pattern Editing"));
|
||||||
|
|
||||||
askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion"));
|
askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion"));
|
||||||
askPointDeletionCheck->setChecked(qApp->getSettings()->GetConfirmItemDelete());
|
askPointDeletionCheck->setChecked(qApp->Settings()->GetConfirmItemDelete());
|
||||||
|
|
||||||
QVBoxLayout *editLayout = new QVBoxLayout;
|
QVBoxLayout *editLayout = new QVBoxLayout;
|
||||||
editLayout->addWidget(askPointDeletionCheck);
|
editLayout->addWidget(askPointDeletionCheck);
|
||||||
|
@ -301,7 +301,7 @@ QGroupBox *ConfigurationPage::ToolBarGroup()
|
||||||
QGroupBox *toolBarGroup = new QGroupBox(tr("Toolbar"));
|
QGroupBox *toolBarGroup = new QGroupBox(tr("Toolbar"));
|
||||||
|
|
||||||
toolBarStyleCheck = new QCheckBox(tr("The text appears under the icon. (recommended for beginners.)"));
|
toolBarStyleCheck = new QCheckBox(tr("The text appears under the icon. (recommended for beginners.)"));
|
||||||
toolBarStyleCheck->setChecked(qApp->getSettings()->GetToolBarStyle());
|
toolBarStyleCheck->setChecked(qApp->Settings()->GetToolBarStyle());
|
||||||
|
|
||||||
QVBoxLayout *editLayout = new QVBoxLayout;
|
QVBoxLayout *editLayout = new QVBoxLayout;
|
||||||
editLayout->addWidget(toolBarStyleCheck);
|
editLayout->addWidget(toolBarStyleCheck);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "pathpage.h"
|
#include "pathpage.h"
|
||||||
#include "../../../options.h"
|
#include "../../../options.h"
|
||||||
#include "../../../core/vapplication.h"
|
#include "../../../core/vapplication.h"
|
||||||
#include "../../../core/vsettings.h"
|
#include "../../../../libs/vmisc/vsettings.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -62,10 +62,10 @@ PathPage::PathPage(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PathPage::Apply()
|
void PathPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->getSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
qApp->Settings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
||||||
qApp->getSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
qApp->Settings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
||||||
qApp->getSettings()->SetPathPattern(pathTable->item(2, 1)->text());
|
qApp->Settings()->SetPathPattern(pathTable->item(2, 1)->text());
|
||||||
qApp->getSettings()->SetPathLayout(pathTable->item(3, 1)->text());
|
qApp->Settings()->SetPathLayout(pathTable->item(3, 1)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -113,16 +113,16 @@ void PathPage::EditPath()
|
||||||
switch (row)
|
switch (row)
|
||||||
{
|
{
|
||||||
case 0: // individual measurements
|
case 0: // individual measurements
|
||||||
path = qApp->getSettings()->GetPathIndividualMeasurements();
|
path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||||
break;
|
break;
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
path = qApp->getSettings()->GetPathStandardMeasurements();
|
path = qApp->Settings()->GetPathStandardMeasurements();
|
||||||
break;
|
break;
|
||||||
case 2: // pattern path
|
case 2: // pattern path
|
||||||
path = qApp->getSettings()->GetPathPattern();
|
path = qApp->Settings()->GetPathPattern();
|
||||||
break;
|
break;
|
||||||
case 3: // layout path
|
case 3: // layout path
|
||||||
path = qApp->getSettings()->GetPathLayout();
|
path = qApp->Settings()->GetPathLayout();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -182,29 +182,29 @@ void PathPage::InitTable()
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathIndividualMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathIndividualMeasurements());
|
||||||
item->setToolTip(qApp->getSettings()->GetPathIndividualMeasurements());
|
item->setToolTip(qApp->Settings()->GetPathIndividualMeasurements());
|
||||||
pathTable->setItem(0, 1, item);
|
pathTable->setItem(0, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathStandardMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathStandardMeasurements());
|
||||||
item->setToolTip(qApp->getSettings()->GetPathStandardMeasurements());
|
item->setToolTip(qApp->Settings()->GetPathStandardMeasurements());
|
||||||
pathTable->setItem(1, 1, item);
|
pathTable->setItem(1, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
|
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathPattern());
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathPattern());
|
||||||
item->setToolTip(qApp->getSettings()->GetPathPattern());
|
item->setToolTip(qApp->Settings()->GetPathPattern());
|
||||||
pathTable->setItem(2, 1, item);
|
pathTable->setItem(2, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
|
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathLayout());
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathLayout());
|
||||||
item->setToolTip(qApp->getSettings()->GetPathLayout());
|
item->setToolTip(qApp->Settings()->GetPathLayout());
|
||||||
pathTable->setItem(3, 1, item);
|
pathTable->setItem(3, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include "patternpage.h"
|
#include "patternpage.h"
|
||||||
#include "../../../options.h"
|
#include "../../../options.h"
|
||||||
#include "../../../core/vapplication.h"
|
#include "../../../core/vapplication.h"
|
||||||
#include "../../../core/vsettings.h"
|
#include "../../../../libs/vmisc/vsettings.h"
|
||||||
#include "../../../widgets/vmaingraphicsview.h"
|
#include "../../../../libs/vwidgets/vmaingraphicsview.h"
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
@ -58,17 +58,17 @@ PatternPage::PatternPage(QWidget *parent):
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PatternPage::Apply()
|
void PatternPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->getSettings()->SetUser(userName->text());
|
qApp->Settings()->SetUser(userName->text());
|
||||||
|
|
||||||
// Scene antialiasing
|
// Scene antialiasing
|
||||||
qApp->getSettings()->SetGraphicalOutput(graphOutputCheck->isChecked());
|
qApp->Settings()->SetGraphicalOutput(graphOutputCheck->isChecked());
|
||||||
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
||||||
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
||||||
|
|
||||||
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
||||||
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
||||||
* prints a warning and does nothing.*/
|
* prints a warning and does nothing.*/
|
||||||
qApp->getSettings()->SetUndoCount(undoCount->value());
|
qApp->Settings()->SetUndoCount(undoCount->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -78,7 +78,7 @@ QGroupBox *PatternPage::UserGroup()
|
||||||
QLabel *nameLabel = new QLabel(tr("User name"));
|
QLabel *nameLabel = new QLabel(tr("User name"));
|
||||||
|
|
||||||
userName = new QLineEdit;
|
userName = new QLineEdit;
|
||||||
userName->setText(qApp->getSettings()->GetUser());
|
userName->setText(qApp->Settings()->GetUser());
|
||||||
|
|
||||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||||
nameLayout->addWidget(nameLabel);
|
nameLayout->addWidget(nameLabel);
|
||||||
|
@ -96,7 +96,7 @@ QGroupBox *PatternPage::GraphOutputGroup()
|
||||||
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
||||||
|
|
||||||
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
||||||
graphOutputCheck->setChecked(qApp->getSettings()->GetGraphicalOutput());
|
graphOutputCheck->setChecked(qApp->Settings()->GetGraphicalOutput());
|
||||||
|
|
||||||
QHBoxLayout *graphLayout = new QHBoxLayout;
|
QHBoxLayout *graphLayout = new QHBoxLayout;
|
||||||
graphLayout->addWidget(graphOutputCheck);
|
graphLayout->addWidget(graphOutputCheck);
|
||||||
|
@ -114,7 +114,7 @@ QGroupBox *PatternPage::UndoGroup()
|
||||||
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
||||||
undoCount = new QSpinBox;
|
undoCount = new QSpinBox;
|
||||||
undoCount->setMinimum(0);
|
undoCount->setMinimum(0);
|
||||||
undoCount->setValue(qApp->getSettings()->GetUndoCount());
|
undoCount->setValue(qApp->Settings()->GetUndoCount());
|
||||||
|
|
||||||
QHBoxLayout *countLayout = new QHBoxLayout;
|
QHBoxLayout *countLayout = new QHBoxLayout;
|
||||||
countLayout->addWidget(undoLabel);
|
countLayout->addWidget(undoLabel);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "../../options.h"
|
#include "../../options.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
|
@ -42,7 +42,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
|
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
|
||||||
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
#include "../../libs/vgeometry/varc.h"
|
#include "../../libs/vgeometry/varc.h"
|
||||||
#include "../../libs/vgeometry/vsplinepath.h"
|
#include "../../libs/vgeometry/vsplinepath.h"
|
||||||
#include "../../libs/vgeometry/vpointf.h"
|
#include "../../libs/vgeometry/vpointf.h"
|
||||||
#include "../../tools/vabstracttool.h"
|
#include "../../libs/vtools/tools/vabstracttool.h"
|
||||||
#include "../../tools/drawTools/vtoolcutspline.h"
|
#include "../../libs/vtools/tools/drawTools/vtoolcutspline.h"
|
||||||
#include "../../tools/drawTools/vtoolcutsplinepath.h"
|
#include "../../libs/vtools/tools/drawTools/vtoolcutsplinepath.h"
|
||||||
#include "../../tools/drawTools/vtoolcutarc.h"
|
#include "../../libs/vtools/tools/drawTools/vtoolcutarc.h"
|
||||||
#include "../../xml/vpattern.h"
|
#include "../../xml/vpattern.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -50,7 +50,7 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef DIALOGHISTORY_H
|
#ifndef DIALOGHISTORY_H
|
||||||
#define DIALOGHISTORY_H
|
#define DIALOGHISTORY_H
|
||||||
|
|
||||||
#include "../tools/dialogtool.h"
|
#include "../../libs/vtools/dialogs/tools/dialogtool.h"
|
||||||
|
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,14 @@
|
||||||
|
|
||||||
#include "dialogincrements.h"
|
#include "dialogincrements.h"
|
||||||
#include "ui_dialogincrements.h"
|
#include "ui_dialogincrements.h"
|
||||||
#include "../../widgets/doubledelegate.h"
|
#include "../../libs/vwidgets/doubledelegate.h"
|
||||||
#include "../../widgets/textdelegate.h"
|
#include "../../libs/vwidgets/textdelegate.h"
|
||||||
#include "../../widgets/vwidgetpopup.h"
|
#include "../../libs/vwidgets/vwidgetpopup.h"
|
||||||
#include "../../xml/vstandardmeasurements.h"
|
#include "../../xml/vstandardmeasurements.h"
|
||||||
#include "../../xml/vindividualmeasurements.h"
|
#include "../../xml/vindividualmeasurements.h"
|
||||||
#include "../../core/vsettings.h"
|
#include "../../libs/vmisc/vsettings.h"
|
||||||
|
#include "../../libs/qmuparser/qmudef.h"
|
||||||
|
#include "../../libs/vpatterndb/vtranslatevars.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -56,7 +58,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
qCDebug(vDialog, "Showing variables.");
|
qCDebug(vDialog, "Showing variables.");
|
||||||
if (qApp->patternType() == MeasurementsType::Individual)
|
if (qApp->patternType() == MeasurementsType::Individual)
|
||||||
|
@ -613,7 +615,7 @@ void DialogIncrements::OpenTable()
|
||||||
const QString filter(tr("Individual measurements (*.vit)"));
|
const QString filter(tr("Individual measurements (*.vit)"));
|
||||||
|
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString path = qApp->getSettings()->GetPathIndividualMeasurements();
|
const QString path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
if (filePath.isEmpty())
|
if (filePath.isEmpty())
|
||||||
|
@ -656,7 +658,7 @@ void DialogIncrements::OpenTable()
|
||||||
{
|
{
|
||||||
const QString filter(tr("Standard measurements (*.vst)"));
|
const QString filter(tr("Standard measurements (*.vst)"));
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString path = qApp->getSettings()->GetPathStandardMeasurements();
|
const QString path = qApp->Settings()->GetPathStandardMeasurements();
|
||||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
if (filePath.isEmpty())
|
if (filePath.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef DIALOGINCREMENTS_H
|
#ifndef DIALOGINCREMENTS_H
|
||||||
#define DIALOGINCREMENTS_H
|
#define DIALOGINCREMENTS_H
|
||||||
|
|
||||||
#include "../tools/dialogtool.h"
|
#include "../../libs/vtools/dialogs/tools/dialogtool.h"
|
||||||
#include "../../xml/vpattern.h"
|
#include "../../xml/vpattern.h"
|
||||||
|
|
||||||
class VIndividualMeasurements;
|
class VIndividualMeasurements;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "ui_dialogindividualmeasurements.h"
|
#include "ui_dialogindividualmeasurements.h"
|
||||||
#include "../../xml/vindividualmeasurements.h"
|
#include "../../xml/vindividualmeasurements.h"
|
||||||
#include "../../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
#include "../../core/vsettings.h"
|
#include "../../libs/vmisc/vsettings.h"
|
||||||
#include "../../libs/vpatterndb/vcontainer.h"
|
#include "../../libs/vpatterndb/vcontainer.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -47,7 +47,7 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
QRect position = this->frameGeometry();
|
QRect position = this->frameGeometry();
|
||||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||||
|
@ -199,7 +199,7 @@ void DialogIndividualMeasurements::CheckState()
|
||||||
void DialogIndividualMeasurements::OpenTable()
|
void DialogIndividualMeasurements::OpenTable()
|
||||||
{
|
{
|
||||||
const QString filter(tr("Individual measurements (*.vit)"));
|
const QString filter(tr("Individual measurements (*.vit)"));
|
||||||
const QString path = qApp->getSettings()->GetPathIndividualMeasurements();
|
const QString path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
|
@ -228,7 +228,7 @@ void DialogIndividualMeasurements::OpenTable()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIndividualMeasurements::NewTable()
|
void DialogIndividualMeasurements::NewTable()
|
||||||
{
|
{
|
||||||
const QString dir = qApp->getSettings()->GetPathIndividualMeasurements()+"/measurements.vit";
|
const QString dir = qApp->Settings()->GetPathIndividualMeasurements()+"/measurements.vit";
|
||||||
QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), dir,
|
QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), dir,
|
||||||
tr("Individual measurements (*.vit)"));
|
tr("Individual measurements (*.vit)"));
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ void DialogIndividualMeasurements::InitUnits()
|
||||||
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
const qint32 indexUnit = ui->comboBoxUnits->findData(qApp->getSettings()->GetUnit());
|
const qint32 indexUnit = ui->comboBoxUnits->findData(qApp->Settings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxUnits->setCurrentIndex(indexUnit);
|
ui->comboBoxUnits->setCurrentIndex(indexUnit);
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
#include "dialoglayoutprogress.h"
|
#include "dialoglayoutprogress.h"
|
||||||
#include "ui_dialoglayoutprogress.h"
|
#include "ui_dialoglayoutprogress.h"
|
||||||
#include "../options.h"
|
#include "../../options.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -41,7 +41,7 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ui->progressBar->setMaximum(maxCount);
|
ui->progressBar->setMaximum(maxCount);
|
||||||
ui->progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
|
|
|
@ -30,11 +30,11 @@
|
||||||
#include "ui_dialoglayoutsettings.h"
|
#include "ui_dialoglayoutsettings.h"
|
||||||
#include "../../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
#include "../../libs/ifc/xml/vdomdocument.h"
|
#include "../../libs/ifc/xml/vdomdocument.h"
|
||||||
#include "../../core/vsettings.h"
|
#include "../../libs/vmisc/vsettings.h"
|
||||||
#include "../../libs/vlayout/vlayoutgenerator.h"
|
#include "../../libs/vlayout/vlayoutgenerator.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../../utils/vmath.h"
|
# include "../../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,7 +52,7 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
|
|
||||||
|
@ -359,8 +359,8 @@ void DialogLayoutSettings::InitPaperUnits()
|
||||||
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(VDomDocument::UnitsToStr(Unit::Px)));
|
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(VDomDocument::UnitsToStr(Unit::Px)));
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
oldPaperUnit = VDomDocument::StrToUnits(qApp->getSettings()->GetUnit());
|
oldPaperUnit = VDomDocument::StrToUnits(qApp->Settings()->GetUnit());
|
||||||
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->getSettings()->GetUnit());
|
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->Settings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
||||||
|
@ -375,8 +375,8 @@ void DialogLayoutSettings::InitLayoutUnits()
|
||||||
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
oldLayoutUnit = VDomDocument::StrToUnits(qApp->getSettings()->GetUnit());
|
oldLayoutUnit = VDomDocument::StrToUnits(qApp->Settings()->GetUnit());
|
||||||
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->getSettings()->GetUnit());
|
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->Settings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||||
|
@ -607,33 +607,33 @@ void DialogLayoutSettings::ReadSettings()
|
||||||
MinimumPaperSize();
|
MinimumPaperSize();
|
||||||
MinimumLayoutSize();
|
MinimumLayoutSize();
|
||||||
|
|
||||||
SetLayoutWidth(qApp->getSettings()->GetLayoutWidth());
|
SetLayoutWidth(qApp->Settings()->GetLayoutWidth());
|
||||||
SetShift(qApp->getSettings()->GetLayoutShift());
|
SetShift(qApp->Settings()->GetLayoutShift());
|
||||||
|
|
||||||
const qreal width = UnitConvertor(qApp->getSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
const qreal width = UnitConvertor(qApp->Settings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
||||||
const qreal height = UnitConvertor(qApp->getSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
const qreal height = UnitConvertor(qApp->Settings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
||||||
SheetSize(QSizeF(width, height));
|
SheetSize(QSizeF(width, height));
|
||||||
SetGroup(qApp->getSettings()->GetLayoutGroup());
|
SetGroup(qApp->Settings()->GetLayoutGroup());
|
||||||
SetRotate(qApp->getSettings()->GetLayoutRotate());
|
SetRotate(qApp->Settings()->GetLayoutRotate());
|
||||||
SetIncrease(qApp->getSettings()->GetLayoutRotationIncrease());
|
SetIncrease(qApp->Settings()->GetLayoutRotationIncrease());
|
||||||
SetAutoCrop(qApp->getSettings()->GetLayoutAutoCrop());
|
SetAutoCrop(qApp->Settings()->GetLayoutAutoCrop());
|
||||||
SetSaveLength(qApp->getSettings()->GetLayoutSaveLength());
|
SetSaveLength(qApp->Settings()->GetLayoutSaveLength());
|
||||||
SetUnitePages(qApp->getSettings()->GetLayoutUnitePages());
|
SetUnitePages(qApp->Settings()->GetLayoutUnitePages());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::WriteSettings() const
|
void DialogLayoutSettings::WriteSettings() const
|
||||||
{
|
{
|
||||||
qApp->getSettings()->SetLayoutWidth(GetLayoutWidth());
|
qApp->Settings()->SetLayoutWidth(GetLayoutWidth());
|
||||||
qApp->getSettings()->SetLayoutGroup(GetGroup());
|
qApp->Settings()->SetLayoutGroup(GetGroup());
|
||||||
qApp->getSettings()->SetLayoutPaperHeight(GetPaperHeight());
|
qApp->Settings()->SetLayoutPaperHeight(GetPaperHeight());
|
||||||
qApp->getSettings()->SetLayoutPaperWidth(GetPaperWidth());
|
qApp->Settings()->SetLayoutPaperWidth(GetPaperWidth());
|
||||||
qApp->getSettings()->SetLayoutShift(GetShift());
|
qApp->Settings()->SetLayoutShift(GetShift());
|
||||||
qApp->getSettings()->SetLayoutRotate(GetRotate());
|
qApp->Settings()->SetLayoutRotate(GetRotate());
|
||||||
qApp->getSettings()->SetLayoutRotationIncrease(GetIncrease());
|
qApp->Settings()->SetLayoutRotationIncrease(GetIncrease());
|
||||||
qApp->getSettings()->SetLayoutAutoCrop(GetAutoCrop());
|
qApp->Settings()->SetLayoutAutoCrop(GetAutoCrop());
|
||||||
qApp->getSettings()->SetLayoutSaveLength(IsSaveLength());
|
qApp->Settings()->SetLayoutSaveLength(IsSaveLength());
|
||||||
qApp->getSettings()->SetLayoutUnitePages(IsUnitePages());
|
qApp->Settings()->SetLayoutUnitePages(IsUnitePages());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "dialogmeasurements.h"
|
#include "dialogmeasurements.h"
|
||||||
#include "ui_dialogmeasurements.h"
|
#include "ui_dialogmeasurements.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
||||||
|
@ -36,7 +36,7 @@ DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
|
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
|
||||||
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
|
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
|
||||||
|
|
|
@ -45,7 +45,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
|
||||||
|
|
||||||
SCASSERT(doc != nullptr);
|
SCASSERT(doc != nullptr);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ui->lineEditAuthor->setText(doc->GetAuthor());
|
ui->lineEditAuthor->setText(doc->GetAuthor());
|
||||||
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "dialogpatternxmledit.h"
|
#include "dialogpatternxmledit.h"
|
||||||
#include "ui_dialogpatternxmledit.h"
|
#include "ui_dialogpatternxmledit.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -46,7 +46,7 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
this->xmlmodel = new VXMLTreeView();
|
this->xmlmodel = new VXMLTreeView();
|
||||||
this->doc=xmldoc;
|
this->doc=xmldoc;
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
#include "dialogsavelayout.h"
|
#include "dialogsavelayout.h"
|
||||||
#include "ui_dialogsavelayout.h"
|
#include "ui_dialogsavelayout.h"
|
||||||
#include "../options.h"
|
#include "../../options.h"
|
||||||
#include "../../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
#include "../../core/vsettings.h"
|
#include "../../libs/vmisc/vsettings.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -43,7 +43,7 @@ DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int c
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
SCASSERT(bOk != nullptr);
|
SCASSERT(bOk != nullptr);
|
||||||
|
@ -67,7 +67,7 @@ DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int c
|
||||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, &DialogSaveLayout::Browse);
|
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, &DialogSaveLayout::Browse);
|
||||||
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
||||||
|
|
||||||
ui->lineEditPath->setText(qApp->getSettings()->GetPathLayout());
|
ui->lineEditPath->setText(qApp->Settings()->GetPathLayout());
|
||||||
ShowExample();//Show example for current format.
|
ShowExample();//Show example for current format.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include "ui_dialogstandardmeasurements.h"
|
#include "ui_dialogstandardmeasurements.h"
|
||||||
#include "../../xml/vstandardmeasurements.h"
|
#include "../../xml/vstandardmeasurements.h"
|
||||||
#include "../../core/vapplication.h"
|
#include "../../core/vapplication.h"
|
||||||
#include "../../core/vsettings.h"
|
#include "../../libs/vmisc/vsettings.h"
|
||||||
#include "../../libs/vpatterndb/vcontainer.h"
|
#include "../../libs/vpatterndb/vcontainer.h"
|
||||||
#include "../../utils/logging.h"
|
#include "../vmisc/logging.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -47,7 +47,7 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
QRect position = this->frameGeometry();
|
QRect position = this->frameGeometry();
|
||||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||||
|
@ -153,7 +153,7 @@ void DialogStandardMeasurements::LoadStandardTables()
|
||||||
qCDebug(vStMeasur, "Loading standard table.");
|
qCDebug(vStMeasur, "Loading standard table.");
|
||||||
QStringList filters{"*.vst"};
|
QStringList filters{"*.vst"};
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString path = qApp->getSettings()->GetPathStandardMeasurements();
|
const QString path = qApp->Settings()->GetPathStandardMeasurements();
|
||||||
QDir tablesDir(path);
|
QDir tablesDir(path);
|
||||||
tablesDir.setNameFilters(filters);
|
tablesDir.setNameFilters(filters);
|
||||||
tablesDir.setCurrent(path);
|
tablesDir.setCurrent(path);
|
||||||
|
|
|
@ -29,34 +29,6 @@
|
||||||
#ifndef DIALOGS_H
|
#ifndef DIALOGS_H
|
||||||
#define DIALOGS_H
|
#define DIALOGS_H
|
||||||
|
|
||||||
#include "tools/dialogalongline.h"
|
|
||||||
#include "tools/dialogarc.h"
|
|
||||||
#include "tools/dialogarcwithlength.h"
|
|
||||||
#include "tools/dialogbisector.h"
|
|
||||||
#include "tools/dialogdetail.h"
|
|
||||||
#include "tools/dialogendline.h"
|
|
||||||
#include "tools/dialogline.h"
|
|
||||||
#include "tools/dialoglineintersect.h"
|
|
||||||
#include "tools/dialognormal.h"
|
|
||||||
#include "tools/dialogpointofcontact.h"
|
|
||||||
#include "tools/dialogshoulderpoint.h"
|
|
||||||
#include "tools/dialogsinglepoint.h"
|
|
||||||
#include "tools/dialogspline.h"
|
|
||||||
#include "tools/dialogsplinepath.h"
|
|
||||||
#include "tools/dialogheight.h"
|
|
||||||
#include "tools/dialogcutarc.h"
|
|
||||||
#include "tools/dialogcutspline.h"
|
|
||||||
#include "tools/dialogcutsplinepath.h"
|
|
||||||
#include "tools/dialoguniondetails.h"
|
|
||||||
#include "tools/dialogtriangle.h"
|
|
||||||
#include "tools/dialogpointofintersection.h"
|
|
||||||
#include "tools/dialoglineintersectaxis.h"
|
|
||||||
#include "tools/dialogcurveintersectaxis.h"
|
|
||||||
#include "tools/dialogpointofintersectionarcs.h"
|
|
||||||
#include "tools/dialogpointofintersectioncircles.h"
|
|
||||||
#include "tools/dialogpointfromcircleandtangent.h"
|
|
||||||
#include "tools/dialogpointfromarcandtangent.h"
|
|
||||||
|
|
||||||
#include "app/dialoghistory.h"
|
#include "app/dialoghistory.h"
|
||||||
#include "app/dialogincrements.h"
|
#include "app/dialogincrements.h"
|
||||||
#include "app/configdialog.h"
|
#include "app/configdialog.h"
|
||||||
|
|
|
@ -3,29 +3,6 @@
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/dialogs.h \
|
$$PWD/dialogs.h \
|
||||||
$$PWD/tools/dialogtriangle.h \
|
|
||||||
$$PWD/tools/dialogtool.h \
|
|
||||||
$$PWD/tools/dialogsplinepath.h \
|
|
||||||
$$PWD/tools/dialogspline.h \
|
|
||||||
$$PWD/tools/dialogsinglepoint.h \
|
|
||||||
$$PWD/tools/dialogshoulderpoint.h \
|
|
||||||
$$PWD/tools/dialogpointofintersection.h \
|
|
||||||
$$PWD/tools/dialogpointofcontact.h \
|
|
||||||
$$PWD/tools/dialognormal.h \
|
|
||||||
$$PWD/tools/dialoglineintersect.h \
|
|
||||||
$$PWD/tools/dialogline.h \
|
|
||||||
$$PWD/tools/dialogheight.h \
|
|
||||||
$$PWD/tools/dialogendline.h \
|
|
||||||
$$PWD/tools/dialogdetail.h \
|
|
||||||
$$PWD/tools/dialogbisector.h \
|
|
||||||
$$PWD/tools/dialogarc.h \
|
|
||||||
$$PWD/tools/dialogalongline.h \
|
|
||||||
$$PWD/tools/dialogcutspline.h \
|
|
||||||
$$PWD/tools/dialogcutsplinepath.h \
|
|
||||||
$$PWD/tools/dialoguniondetails.h \
|
|
||||||
$$PWD/tools/dialogcutarc.h \
|
|
||||||
$$PWD/tools/dialogeditwrongformula.h \
|
|
||||||
$$PWD/tools/dialoglineintersectaxis.h \
|
|
||||||
$$PWD/app/dialogincrements.h \
|
$$PWD/app/dialogincrements.h \
|
||||||
$$PWD/app/dialoghistory.h \
|
$$PWD/app/dialoghistory.h \
|
||||||
$$PWD/app/configdialog.h \
|
$$PWD/app/configdialog.h \
|
||||||
|
@ -40,41 +17,11 @@ HEADERS += \
|
||||||
$$PWD/app/configpages/patternpage.h \
|
$$PWD/app/configpages/patternpage.h \
|
||||||
$$PWD/app/configpages/communitypage.h \
|
$$PWD/app/configpages/communitypage.h \
|
||||||
$$PWD/app/configpages/pathpage.h \
|
$$PWD/app/configpages/pathpage.h \
|
||||||
$$PWD/app/dialogundo.h \
|
|
||||||
$$PWD/tools/dialogcurveintersectaxis.h \
|
|
||||||
$$PWD/app/dialoglayoutsettings.h \
|
$$PWD/app/dialoglayoutsettings.h \
|
||||||
$$PWD/app/dialoglayoutprogress.h \
|
$$PWD/app/dialoglayoutprogress.h \
|
||||||
$$PWD/app/dialogsavelayout.h \
|
$$PWD/app/dialogsavelayout.h
|
||||||
$$PWD/tools/dialogpointofintersectionarcs.h \
|
|
||||||
$$PWD/tools/dialogpointofintersectioncircles.h \
|
|
||||||
$$PWD/tools/dialogpointfromcircleandtangent.h \
|
|
||||||
$$PWD/tools/dialogpointfromarcandtangent.h \
|
|
||||||
$$PWD/tools/dialogarcwithlength.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/tools/dialogtriangle.cpp \
|
|
||||||
$$PWD/tools/dialogtool.cpp \
|
|
||||||
$$PWD/tools/dialogsplinepath.cpp \
|
|
||||||
$$PWD/tools/dialogspline.cpp \
|
|
||||||
$$PWD/tools/dialogsinglepoint.cpp \
|
|
||||||
$$PWD/tools/dialogshoulderpoint.cpp \
|
|
||||||
$$PWD/tools/dialogpointofintersection.cpp \
|
|
||||||
$$PWD/tools/dialogpointofcontact.cpp \
|
|
||||||
$$PWD/tools/dialognormal.cpp \
|
|
||||||
$$PWD/tools/dialoglineintersect.cpp \
|
|
||||||
$$PWD/tools/dialogline.cpp \
|
|
||||||
$$PWD/tools/dialogheight.cpp \
|
|
||||||
$$PWD/tools/dialogendline.cpp \
|
|
||||||
$$PWD/tools/dialogdetail.cpp \
|
|
||||||
$$PWD/tools/dialogbisector.cpp \
|
|
||||||
$$PWD/tools/dialogarc.cpp \
|
|
||||||
$$PWD/tools/dialogalongline.cpp \
|
|
||||||
$$PWD/tools/dialogcutspline.cpp \
|
|
||||||
$$PWD/tools/dialogcutsplinepath.cpp \
|
|
||||||
$$PWD/tools/dialoguniondetails.cpp \
|
|
||||||
$$PWD/tools/dialogcutarc.cpp \
|
|
||||||
$$PWD/tools/dialogeditwrongformula.cpp \
|
|
||||||
$$PWD/tools/dialoglineintersectaxis.cpp \
|
|
||||||
$$PWD/app/dialogincrements.cpp \
|
$$PWD/app/dialogincrements.cpp \
|
||||||
$$PWD/app/dialoghistory.cpp \
|
$$PWD/app/dialoghistory.cpp \
|
||||||
$$PWD/app/configdialog.cpp \
|
$$PWD/app/configdialog.cpp \
|
||||||
|
@ -88,40 +35,11 @@ SOURCES += \
|
||||||
$$PWD/app/configpages/patternpage.cpp \
|
$$PWD/app/configpages/patternpage.cpp \
|
||||||
$$PWD/app/configpages/communitypage.cpp \
|
$$PWD/app/configpages/communitypage.cpp \
|
||||||
$$PWD/app/configpages/pathpage.cpp \
|
$$PWD/app/configpages/pathpage.cpp \
|
||||||
$$PWD/app/dialogundo.cpp \
|
|
||||||
$$PWD/tools/dialogcurveintersectaxis.cpp \
|
|
||||||
$$PWD/app/dialoglayoutsettings.cpp \
|
$$PWD/app/dialoglayoutsettings.cpp \
|
||||||
$$PWD/app/dialoglayoutprogress.cpp \
|
$$PWD/app/dialoglayoutprogress.cpp \
|
||||||
$$PWD/app/dialogsavelayout.cpp \
|
$$PWD/app/dialogsavelayout.cpp
|
||||||
$$PWD/tools/dialogpointofintersectionarcs.cpp \
|
|
||||||
$$PWD/tools/dialogpointofintersectioncircles.cpp \
|
|
||||||
$$PWD/tools/dialogpointfromcircleandtangent.cpp \
|
|
||||||
$$PWD/tools/dialogpointfromarcandtangent.cpp \
|
|
||||||
$$PWD/tools/dialogarcwithlength.cpp
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tools/dialogtriangle.ui \
|
|
||||||
$$PWD/tools/dialogsplinepath.ui \
|
|
||||||
$$PWD/tools/dialogspline.ui \
|
|
||||||
$$PWD/tools/dialogsinglepoint.ui \
|
|
||||||
$$PWD/tools/dialogshoulderpoint.ui \
|
|
||||||
$$PWD/tools/dialogpointofintersection.ui \
|
|
||||||
$$PWD/tools/dialogpointofcontact.ui \
|
|
||||||
$$PWD/tools/dialognormal.ui \
|
|
||||||
$$PWD/tools/dialoglineintersect.ui \
|
|
||||||
$$PWD/tools/dialogline.ui \
|
|
||||||
$$PWD/tools/dialogheight.ui \
|
|
||||||
$$PWD/tools/dialogendline.ui \
|
|
||||||
$$PWD/tools/dialogdetail.ui \
|
|
||||||
$$PWD/tools/dialogbisector.ui \
|
|
||||||
$$PWD/tools/dialogarc.ui \
|
|
||||||
$$PWD/tools/dialogalongline.ui \
|
|
||||||
$$PWD/tools/dialogcutspline.ui \
|
|
||||||
$$PWD/tools/dialogcutsplinepath.ui \
|
|
||||||
$$PWD/tools/dialoguniondetails.ui \
|
|
||||||
$$PWD/tools/dialogcutarc.ui \
|
|
||||||
$$PWD/tools/dialogeditwrongformula.ui \
|
|
||||||
$$PWD/tools/dialoglineintersectaxis.ui \
|
|
||||||
$$PWD/app/dialogincrements.ui \
|
$$PWD/app/dialogincrements.ui \
|
||||||
$$PWD/app/dialoghistory.ui \
|
$$PWD/app/dialoghistory.ui \
|
||||||
$$PWD/app/dialogpatternproperties.ui \
|
$$PWD/app/dialogpatternproperties.ui \
|
||||||
|
@ -130,13 +48,6 @@ FORMS += \
|
||||||
$$PWD/app/dialogindividualmeasurements.ui \
|
$$PWD/app/dialogindividualmeasurements.ui \
|
||||||
$$PWD/app/dialogaboutapp.ui \
|
$$PWD/app/dialogaboutapp.ui \
|
||||||
$$PWD/app/dialogpatternxmledit.ui \
|
$$PWD/app/dialogpatternxmledit.ui \
|
||||||
$$PWD/app/dialogundo.ui \
|
|
||||||
$$PWD/tools/dialogcurveintersectaxis.ui \
|
|
||||||
$$PWD/app/dialoglayoutsettings.ui \
|
$$PWD/app/dialoglayoutsettings.ui \
|
||||||
$$PWD/app/dialoglayoutprogress.ui \
|
$$PWD/app/dialoglayoutprogress.ui \
|
||||||
$$PWD/app/dialogsavelayout.ui \
|
$$PWD/app/dialogsavelayout.ui
|
||||||
$$PWD/tools/dialogpointofintersectionarcs.ui \
|
|
||||||
$$PWD/tools/dialogpointofintersectioncircles.ui \
|
|
||||||
$$PWD/tools/dialogpointfromcircleandtangent.ui \
|
|
||||||
$$PWD/tools/dialogpointfromarcandtangent.ui \
|
|
||||||
$$PWD/tools/dialogarcwithlength.ui
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "core/vapplication.h"
|
#include "core/vapplication.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||||
# include "../core/backport/qcommandlineparser.h"
|
# include "../libs/vmisc/backport/qcommandlineparser.h"
|
||||||
#else
|
#else
|
||||||
# include <QCommandLineParser>
|
# include <QCommandLineParser>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,13 +38,13 @@
|
||||||
#include "xml/vstandardmeasurements.h"
|
#include "xml/vstandardmeasurements.h"
|
||||||
#include "xml/vindividualmeasurements.h"
|
#include "xml/vindividualmeasurements.h"
|
||||||
#include "core/vapplication.h"
|
#include "core/vapplication.h"
|
||||||
#include "core/undoevent.h"
|
#include "../libs/vmisc/undoevent.h"
|
||||||
#include "core/vsettings.h"
|
#include "../libs/vmisc/vsettings.h"
|
||||||
#include "undocommands/renamepp.h"
|
#include "undocommands/renamepp.h"
|
||||||
#include "vtooloptionspropertybrowser.h"
|
#include "core/vtooloptionspropertybrowser.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "../libs/ifc/xml/vpatternconverter.h"
|
#include "../libs/ifc/xml/vpatternconverter.h"
|
||||||
#include "../../utils/logging.h"
|
#include "../vmisc/logging.h"
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -1480,7 +1480,7 @@ bool MainWindow::SaveAs()
|
||||||
QString dir;
|
QString dir;
|
||||||
if (curFile.isEmpty())
|
if (curFile.isEmpty())
|
||||||
{
|
{
|
||||||
dir = qApp->getSettings()->GetPathPattern() + "/" + tr("pattern") + ".val";
|
dir = qApp->Settings()->GetPathPattern() + "/" + tr("pattern") + ".val";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1513,9 +1513,9 @@ bool MainWindow::SaveAs()
|
||||||
if (oldFileName != curFile)
|
if (oldFileName != curFile)
|
||||||
{// Now we have new file name after save as.
|
{// Now we have new file name after save as.
|
||||||
// But still have previous name in restore list. We should delete them.
|
// But still have previous name in restore list. We should delete them.
|
||||||
QStringList restoreFiles = qApp->getSettings()->GetRestoreFileList();
|
QStringList restoreFiles = qApp->Settings()->GetRestoreFileList();
|
||||||
restoreFiles.removeAll(oldFileName);
|
restoreFiles.removeAll(oldFileName);
|
||||||
qApp->getSettings()->SetRestoreFileList(restoreFiles);
|
qApp->Settings()->SetRestoreFileList(restoreFiles);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1564,7 +1564,7 @@ void MainWindow::Open()
|
||||||
qCDebug(vMainWindow, "Openning new file.");
|
qCDebug(vMainWindow, "Openning new file.");
|
||||||
const QString filter(tr("Pattern files (*.val)"));
|
const QString filter(tr("Pattern files (*.val)"));
|
||||||
//Get list last open files
|
//Get list last open files
|
||||||
const QStringList files = qApp->getSettings()->GetRecentFileList();
|
const QStringList files = qApp->Settings()->GetRecentFileList();
|
||||||
QString dir;
|
QString dir;
|
||||||
if (files.isEmpty())
|
if (files.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1676,9 +1676,9 @@ void MainWindow::FileClosedCorrect()
|
||||||
WriteSettings();
|
WriteSettings();
|
||||||
|
|
||||||
//File was closed correct.
|
//File was closed correct.
|
||||||
QStringList restoreFiles = qApp->getSettings()->GetRestoreFileList();
|
QStringList restoreFiles = qApp->Settings()->GetRestoreFileList();
|
||||||
restoreFiles.removeAll(curFile);
|
restoreFiles.removeAll(curFile);
|
||||||
qApp->getSettings()->SetRestoreFileList(restoreFiles);
|
qApp->Settings()->SetRestoreFileList(restoreFiles);
|
||||||
|
|
||||||
// Remove autosave file
|
// Remove autosave file
|
||||||
QFile autofile(curFile +".autosave");
|
QFile autofile(curFile +".autosave");
|
||||||
|
@ -2035,8 +2035,8 @@ void MainWindow::New()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set scene size to size scene view
|
//Set scene size to size scene view
|
||||||
VAbstractTool::NewSceneRect(sceneDraw, ui->view);
|
VMainGraphicsView::NewSceneRect(sceneDraw, ui->view);
|
||||||
VAbstractTool::NewSceneRect(sceneDetails, ui->view);
|
VMainGraphicsView::NewSceneRect(sceneDetails, ui->view);
|
||||||
ToolBarOption();
|
ToolBarOption();
|
||||||
|
|
||||||
AddPP(patternPieceName, path);
|
AddPP(patternPieceName, path);
|
||||||
|
@ -2309,7 +2309,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Updating recent file list.");
|
qCDebug(vMainWindow, "Updating recent file list.");
|
||||||
QStringList files = qApp->getSettings()->GetRecentFileList();
|
QStringList files = qApp->Settings()->GetRecentFileList();
|
||||||
files.removeAll(fileName);
|
files.removeAll(fileName);
|
||||||
files.prepend(fileName);
|
files.prepend(fileName);
|
||||||
while (files.size() > MaxRecentFiles)
|
while (files.size() > MaxRecentFiles)
|
||||||
|
@ -2317,14 +2317,14 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
||||||
files.removeLast();
|
files.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->getSettings()->SetRecentFileList(files);
|
qApp->Settings()->SetRecentFileList(files);
|
||||||
UpdateRecentFileActions();
|
UpdateRecentFileActions();
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Updating restore file list.");
|
qCDebug(vMainWindow, "Updating restore file list.");
|
||||||
QStringList restoreFiles = qApp->getSettings()->GetRestoreFileList();
|
QStringList restoreFiles = qApp->Settings()->GetRestoreFileList();
|
||||||
restoreFiles.removeAll(fileName);
|
restoreFiles.removeAll(fileName);
|
||||||
restoreFiles.prepend(fileName);
|
restoreFiles.prepend(fileName);
|
||||||
qApp->getSettings()->SetRestoreFileList(restoreFiles);
|
qApp->Settings()->SetRestoreFileList(restoreFiles);
|
||||||
}
|
}
|
||||||
shownName+="[*]";
|
shownName+="[*]";
|
||||||
setWindowTitle(shownName);
|
setWindowTitle(shownName);
|
||||||
|
@ -2348,17 +2348,17 @@ QString MainWindow::strippedName(const QString &fullFileName)
|
||||||
void MainWindow::ReadSettings()
|
void MainWindow::ReadSettings()
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Reading settings.");
|
qCDebug(vMainWindow, "Reading settings.");
|
||||||
restoreGeometry(qApp->getSettings()->GetGeometry());
|
restoreGeometry(qApp->Settings()->GetGeometry());
|
||||||
restoreState(qApp->getSettings()->GetWindowState());
|
restoreState(qApp->Settings()->GetWindowState());
|
||||||
restoreState(qApp->getSettings()->GetToolbarsState(), APP_VERSION);
|
restoreState(qApp->Settings()->GetToolbarsState(), APP_VERSION);
|
||||||
|
|
||||||
// Scene antialiasing
|
// Scene antialiasing
|
||||||
const bool graphOutputValue = qApp->getSettings()->GetGraphicalOutput();
|
const bool graphOutputValue = qApp->Settings()->GetGraphicalOutput();
|
||||||
ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
||||||
ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
||||||
|
|
||||||
// Stack limit
|
// Stack limit
|
||||||
qApp->getUndoStack()->setUndoLimit(qApp->getSettings()->GetUndoCount());
|
qApp->getUndoStack()->setUndoLimit(qApp->Settings()->GetUndoCount());
|
||||||
|
|
||||||
// Text under tool buton icon
|
// Text under tool buton icon
|
||||||
ToolBarStyles();
|
ToolBarStyles();
|
||||||
|
@ -2372,9 +2372,9 @@ void MainWindow::WriteSettings()
|
||||||
{
|
{
|
||||||
ActionDraw(true);
|
ActionDraw(true);
|
||||||
|
|
||||||
qApp->getSettings()->SetGeometry(saveGeometry());
|
qApp->Settings()->SetGeometry(saveGeometry());
|
||||||
qApp->getSettings()->SetWindowState(saveState());
|
qApp->Settings()->SetWindowState(saveState());
|
||||||
qApp->getSettings()->SetToolbarsState(saveState(APP_VERSION));
|
qApp->Settings()->SetToolbarsState(saveState(APP_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2406,7 +2406,7 @@ bool MainWindow::MaybeSave()
|
||||||
void MainWindow::UpdateRecentFileActions()
|
void MainWindow::UpdateRecentFileActions()
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Updating recent file actions.");
|
qCDebug(vMainWindow, "Updating recent file actions.");
|
||||||
const QStringList files = qApp->getSettings()->GetRecentFileList();
|
const QStringList files = qApp->Settings()->GetRecentFileList();
|
||||||
const int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
const int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
||||||
|
|
||||||
for (int i = 0; i < numRecentFiles; ++i)
|
for (int i = 0; i < numRecentFiles; ++i)
|
||||||
|
@ -2685,9 +2685,9 @@ void MainWindow::InitAutoSave()
|
||||||
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
||||||
autoSaveTimer->stop();
|
autoSaveTimer->stop();
|
||||||
|
|
||||||
if (qApp->getSettings()->GetAutosaveState())
|
if (qApp->Settings()->GetAutosaveState())
|
||||||
{
|
{
|
||||||
const qint32 autoTime = qApp->getSettings()->GetAutosaveTime();
|
const qint32 autoTime = qApp->Settings()->GetAutosaveTime();
|
||||||
autoSaveTimer->start(autoTime*60000);
|
autoSaveTimer->start(autoTime*60000);
|
||||||
qCDebug(vMainWindow, "Autosaving each %d minutes.", autoTime);
|
qCDebug(vMainWindow, "Autosaving each %d minutes.", autoTime);
|
||||||
}
|
}
|
||||||
|
@ -2782,8 +2782,8 @@ void MainWindow::LoadPattern(const QString &fileName)
|
||||||
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
|
|
||||||
// On this stage scene empty. Fit scene size to view size
|
// On this stage scene empty. Fit scene size to view size
|
||||||
VAbstractTool::NewSceneRect(sceneDraw, ui->view);
|
VMainGraphicsView::NewSceneRect(sceneDraw, ui->view);
|
||||||
VAbstractTool::NewSceneRect(sceneDetails, ui->view);
|
VMainGraphicsView::NewSceneRect(sceneDetails, ui->view);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
qt_ntfs_permission_lookup++; // turn checking on
|
qt_ntfs_permission_lookup++; // turn checking on
|
||||||
|
@ -2871,7 +2871,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
QStringList restoreFiles;
|
QStringList restoreFiles;
|
||||||
//Take all files that need to be restored
|
//Take all files that need to be restored
|
||||||
QStringList files = qApp->getSettings()->GetRestoreFileList();
|
QStringList files = qApp->Settings()->GetRestoreFileList();
|
||||||
if (files.size() > 0)
|
if (files.size() > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < files.size(); ++i)
|
for (int i = 0; i < files.size(); ++i)
|
||||||
|
@ -2893,7 +2893,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
||||||
files.removeAll(restoreFiles.at(i));
|
files.removeAll(restoreFiles.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->getSettings()->SetRestoreFileList(files);
|
qApp->Settings()->SetRestoreFileList(files);
|
||||||
|
|
||||||
}
|
}
|
||||||
return restoreFiles;
|
return restoreFiles;
|
||||||
|
@ -2905,7 +2905,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::WindowsLocale()
|
void MainWindow::WindowsLocale()
|
||||||
{
|
{
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2939,7 +2939,7 @@ void MainWindow::ShowPaper(int index)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ToolBarStyle(QToolBar *bar)
|
void MainWindow::ToolBarStyle(QToolBar *bar)
|
||||||
{
|
{
|
||||||
if (qApp->getSettings()->GetToolBarStyle())
|
if (qApp->Settings()->GetToolBarStyle())
|
||||||
{
|
{
|
||||||
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||||
}
|
}
|
||||||
|
@ -3023,14 +3023,14 @@ QString MainWindow::CheckPathToMeasurements(const QString &path, const Measureme
|
||||||
{
|
{
|
||||||
filter = tr("Standard measurements (*.vst)");
|
filter = tr("Standard measurements (*.vst)");
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString path = qApp->getSettings()->GetPathStandardMeasurements();
|
const QString path = qApp->Settings()->GetPathStandardMeasurements();
|
||||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filter = tr("Individual measurements (*.vit)");
|
filter = tr("Individual measurements (*.vit)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString path = qApp->getSettings()->GetPathIndividualMeasurements();
|
const QString path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3102,8 +3102,8 @@ void MainWindow::ZoomFirstShow()
|
||||||
ActionDraw(true);
|
ActionDraw(true);
|
||||||
ui->view->ZoomFitBest();
|
ui->view->ZoomFitBest();
|
||||||
|
|
||||||
VAbstractTool::NewSceneRect(sceneDraw, ui->view);
|
VMainGraphicsView::NewSceneRect(sceneDraw, ui->view);
|
||||||
VAbstractTool::NewSceneRect(sceneDetails, ui->view);
|
VMainGraphicsView::NewSceneRect(sceneDetails, ui->view);
|
||||||
|
|
||||||
ActionDetails(true);
|
ActionDetails(true);
|
||||||
ui->view->ZoomFitBest();
|
ui->view->ZoomFitBest();
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include "mainwindowsnogui.h"
|
#include "mainwindowsnogui.h"
|
||||||
#include "widgets/vmaingraphicsview.h"
|
#include "../libs/vwidgets/vmaingraphicsview.h"
|
||||||
|
#include "../libs/vtools/dialogs/tooldialogs.h"
|
||||||
#include "dialogs/dialogs.h"
|
#include "dialogs/dialogs.h"
|
||||||
#include "tools/vtooldetail.h"
|
#include "tools/vtooldetail.h"
|
||||||
#include "tools/vtooluniondetails.h"
|
#include "tools/vtooluniondetails.h"
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "mainwindowsnogui.h"
|
#include "mainwindowsnogui.h"
|
||||||
#include "../core/vapplication.h"
|
#include "core/vapplication.h"
|
||||||
#include "../libs/vpatterndb/vcontainer.h"
|
#include "../libs/vpatterndb/vcontainer.h"
|
||||||
#include "../libs/vobj/vobjpaintdevice.h"
|
#include "../libs/vobj/vobjpaintdevice.h"
|
||||||
#include "../dialogs/app/dialoglayoutsettings.h"
|
#include "dialogs/app/dialoglayoutsettings.h"
|
||||||
#include "../libs/vlayout/vlayoutgenerator.h"
|
#include "../libs/vlayout/vlayoutgenerator.h"
|
||||||
#include "../dialogs/app/dialoglayoutprogress.h"
|
#include "dialogs/app/dialoglayoutprogress.h"
|
||||||
#include "../dialogs/app/dialogsavelayout.h"
|
#include "dialogs/app/dialogsavelayout.h"
|
||||||
#include "../libs/vlayout/vposter.h"
|
#include "../libs/vlayout/vposter.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -154,7 +154,7 @@ void MainWindowsNoGUI::ExportLayoutAs()
|
||||||
suf.replace(".", "");
|
suf.replace(".", "");
|
||||||
|
|
||||||
const QString path = dialog.Path();
|
const QString path = dialog.Path();
|
||||||
qApp->getSettings()->SetPathLayout(path);
|
qApp->Settings()->SetPathLayout(path);
|
||||||
const QString mask = dialog.FileName();
|
const QString mask = dialog.FileName();
|
||||||
|
|
||||||
for (int i=0; i < scenes.size(); ++i)
|
for (int i=0; i < scenes.size(); ++i)
|
||||||
|
@ -400,8 +400,8 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
||||||
Qt::RoundJoin));
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter);
|
scenes.at(i)->render(&painter);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -508,8 +508,8 @@ void MainWindowsNoGUI::SvgFile(const QString &name, int i) const
|
||||||
painter.begin(&generator);
|
painter.begin(&generator);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()), Qt::SolidLine, Qt::RoundCap,
|
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
||||||
Qt::RoundJoin));
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -533,8 +533,8 @@ void MainWindowsNoGUI::PngFile(const QString &name, int i) const
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
||||||
Qt::RoundJoin));
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
image.save(name);
|
image.save(name);
|
||||||
|
@ -577,8 +577,8 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
|
||||||
}
|
}
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
||||||
Qt::RoundJoin));
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -685,15 +685,15 @@ QVector<QImage> MainWindowsNoGUI::AllSheets()
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
||||||
Qt::RoundJoin));
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter);
|
scenes.at(i)->render(&painter);
|
||||||
painter.end();
|
painter.end();
|
||||||
images.append(image);
|
images.append(image);
|
||||||
|
|
||||||
// Resore
|
// Resore
|
||||||
paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
paper->setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit()))));
|
||||||
brush->setColor( QColor( Qt::gray ) );
|
brush->setColor( QColor( Qt::gray ) );
|
||||||
brush->setStyle( Qt::SolidPattern );
|
brush->setStyle( Qt::SolidPattern );
|
||||||
scenes[i]->setBackgroundBrush( *brush );
|
scenes[i]->setBackgroundBrush( *brush );
|
||||||
|
@ -719,7 +719,7 @@ void MainWindowsNoGUI::SaveLayoutAs()
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
||||||
qApp->getSettings()->GetPathLayout()+"/"+FileName()+".pdf",
|
qApp->Settings()->GetPathLayout()+"/"+FileName()+".pdf",
|
||||||
tr("PDF file (*.pdf)"));
|
tr("PDF file (*.pdf)"));
|
||||||
if (not fileName.isEmpty())
|
if (not fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -728,7 +728,7 @@ void MainWindowsNoGUI::SaveLayoutAs()
|
||||||
{
|
{
|
||||||
fileName.append(".pdf");
|
fileName.append(".pdf");
|
||||||
}
|
}
|
||||||
qApp->getSettings()->SetPathLayout(f.absolutePath());
|
qApp->Settings()->SetPathLayout(f.absolutePath());
|
||||||
|
|
||||||
printer.setOutputFileName(fileName);
|
printer.setOutputFileName(fileName);
|
||||||
printer.setResolution(static_cast<int>(PrintDPI));
|
printer.setResolution(static_cast<int>(PrintDPI));
|
||||||
|
|
|
@ -28,10 +28,3 @@
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
|
|
||||||
// furthermore blows up the binary sizes.
|
|
||||||
const QString degreeSymbol = QStringLiteral("°");
|
|
||||||
|
|
||||||
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
|
|
||||||
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "../libs/ifc/ifcdef.h"
|
#include "../libs/ifc/ifcdef.h"
|
||||||
#include "../libs/vgeometry/vgeometrydef.h"
|
#include "../libs/vgeometry/vgeometrydef.h"
|
||||||
#include "../libs/qmuparser/qmudef.h"
|
#include "../libs/qmuparser/qmudef.h"
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
# if defined( Q_CC_MSVC ) // MSVC USED
|
# if defined( Q_CC_MSVC ) // MSVC USED
|
||||||
|
@ -47,18 +47,6 @@
|
||||||
class QString;
|
class QString;
|
||||||
class QStringList;
|
class QStringList;
|
||||||
|
|
||||||
#define SceneSize 50000
|
|
||||||
#define DefPointRadius 1.5//mm
|
|
||||||
|
|
||||||
extern const QString degreeSymbol;
|
|
||||||
|
|
||||||
extern const QString cursorArrowOpenHand;
|
|
||||||
extern const QString cursorArrowCloseHand;
|
|
||||||
|
|
||||||
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
|
|
||||||
|
|
||||||
|
|
||||||
enum class Source : char { FromGui, FromFile, FromTool };
|
|
||||||
enum class Contour : char { OpenContour, CloseContour };
|
enum class Contour : char { OpenContour, CloseContour };
|
||||||
|
|
||||||
#endif // OPTIONS_H
|
#endif // OPTIONS_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,224 +29,62 @@
|
||||||
#ifndef VPATTERN_H
|
#ifndef VPATTERN_H
|
||||||
#define VPATTERN_H
|
#define VPATTERN_H
|
||||||
|
|
||||||
#include "../libs/ifc/xml/vdomdocument.h"
|
#include "../libs/ifc/xml/vabstractpattern.h"
|
||||||
#include "../libs/ifc/xml/vtoolrecord.h"
|
#include "../libs/ifc/xml/vtoolrecord.h"
|
||||||
#include "../libs/vpatterndb/vcontainer.h"
|
#include "../libs/vpatterndb/vcontainer.h"
|
||||||
|
|
||||||
class VDataTool;
|
class VDataTool;
|
||||||
class VMainGraphicsScene;
|
class VMainGraphicsScene;
|
||||||
|
|
||||||
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
|
||||||
enum class LabelType : char {NewPatternPiece, NewLabel};
|
|
||||||
enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VPattern class working with pattern file.
|
* @brief The VPattern class working with pattern file.
|
||||||
*/
|
*/
|
||||||
class VPattern : public QObject, public VDomDocument
|
class VPattern : public VAbstractPattern
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VPattern(VContainer *data, Draw *mode, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
VPattern(VContainer *data, Draw *mode, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
void CreateEmptyFile(const QString &tablePath);
|
virtual void CreateEmptyFile(const QString &tablePath);
|
||||||
void ChangeActivPP(const QString& name, const Document &parse = Document::FullParse);
|
|
||||||
QString GetNameActivPP() const;
|
|
||||||
bool GetActivDrawElement(QDomElement &element) const;
|
|
||||||
bool appendPP(const QString& name);
|
|
||||||
bool ChangeNamePP(const QString& oldName, const QString &newName);
|
|
||||||
QDomElement GetPPElement(const QString &name);
|
|
||||||
bool CheckExistNamePP(const QString& name) const;
|
|
||||||
int CountPP() const;
|
|
||||||
|
|
||||||
void Parse(const Document &parse);
|
void Parse(const Document &parse);
|
||||||
QHash<quint32, VDataTool*>* getTools();
|
|
||||||
VDataTool* getTool(const quint32 &id);
|
|
||||||
QVector<VToolRecord> *getHistory();
|
|
||||||
QVector<VToolRecord> getLocalHistory() const;
|
|
||||||
quint32 getCursor() const;
|
|
||||||
void setCursor(const quint32 &value);
|
|
||||||
void setCurrentData();
|
void setCurrentData();
|
||||||
void AddTool(const quint32 &id, VDataTool *tool);
|
virtual void UpdateToolData(const quint32 &id, VContainer *data);
|
||||||
void UpdateToolData(const quint32 &id, VContainer *data);
|
|
||||||
void IncrementReferens(quint32 id) const;
|
virtual void IncrementReferens(quint32 id) const;
|
||||||
void DecrementReferens(quint32 id) const;
|
virtual void DecrementReferens(quint32 id) const;
|
||||||
|
|
||||||
quint32 SPointActiveDraw();
|
quint32 SPointActiveDraw();
|
||||||
bool isPatternModified() const;
|
|
||||||
void setPatternModified(bool value);
|
|
||||||
bool GetActivNodeElement(const QString& name, QDomElement& element) const;
|
|
||||||
QString MPath() const;
|
|
||||||
void SetPath(const QString &path);
|
|
||||||
Unit MUnit() const;
|
|
||||||
MeasurementsType MType() const;
|
|
||||||
static const QString TagPattern;
|
|
||||||
static const QString TagCalculation;
|
|
||||||
static const QString TagModeling;
|
|
||||||
static const QString TagDetails;
|
|
||||||
static const QString TagAuthor;
|
|
||||||
static const QString TagDescription;
|
|
||||||
static const QString TagNotes;
|
|
||||||
static const QString TagMeasurements;
|
|
||||||
static const QString TagIncrements;
|
|
||||||
static const QString TagIncrement;
|
|
||||||
static const QString TagDraw;
|
|
||||||
static const QString TagPoint;
|
|
||||||
static const QString TagLine;
|
|
||||||
static const QString TagSpline;
|
|
||||||
static const QString TagArc;
|
|
||||||
static const QString TagTools;
|
|
||||||
static const QString TagGradation;
|
|
||||||
static const QString TagHeights;
|
|
||||||
static const QString TagSizes;
|
|
||||||
|
|
||||||
static const QString AttrName;
|
|
||||||
static const QString AttrType;
|
|
||||||
static const QString AttrPath;
|
|
||||||
|
|
||||||
static const QString AttrAll;
|
|
||||||
|
|
||||||
static const QString AttrH92;
|
|
||||||
static const QString AttrH98;
|
|
||||||
static const QString AttrH104;
|
|
||||||
static const QString AttrH110;
|
|
||||||
static const QString AttrH116;
|
|
||||||
static const QString AttrH122;
|
|
||||||
static const QString AttrH128;
|
|
||||||
static const QString AttrH134;
|
|
||||||
static const QString AttrH140;
|
|
||||||
static const QString AttrH146;
|
|
||||||
static const QString AttrH152;
|
|
||||||
static const QString AttrH158;
|
|
||||||
static const QString AttrH164;
|
|
||||||
static const QString AttrH170;
|
|
||||||
static const QString AttrH176;
|
|
||||||
static const QString AttrH182;
|
|
||||||
static const QString AttrH188;
|
|
||||||
static const QString AttrH194;
|
|
||||||
|
|
||||||
static const QString AttrS22;
|
|
||||||
static const QString AttrS24;
|
|
||||||
static const QString AttrS26;
|
|
||||||
static const QString AttrS28;
|
|
||||||
static const QString AttrS30;
|
|
||||||
static const QString AttrS32;
|
|
||||||
static const QString AttrS34;
|
|
||||||
static const QString AttrS36;
|
|
||||||
static const QString AttrS38;
|
|
||||||
static const QString AttrS40;
|
|
||||||
static const QString AttrS42;
|
|
||||||
static const QString AttrS44;
|
|
||||||
static const QString AttrS46;
|
|
||||||
static const QString AttrS48;
|
|
||||||
static const QString AttrS50;
|
|
||||||
static const QString AttrS52;
|
|
||||||
static const QString AttrS54;
|
|
||||||
static const QString AttrS56;
|
|
||||||
|
|
||||||
static const QString IncrementName;
|
|
||||||
static const QString IncrementBase;
|
|
||||||
static const QString IncrementKsize;
|
|
||||||
static const QString IncrementKgrowth;
|
|
||||||
static const QString IncrementDescription;
|
|
||||||
|
|
||||||
virtual bool SaveDocument(const QString &fileName, QString &error) const;
|
virtual bool SaveDocument(const QString &fileName, QString &error) const;
|
||||||
QStringList getPatternPieces() const;
|
|
||||||
QRectF ActiveDrawBoundingRect() const;
|
QRectF ActiveDrawBoundingRect() const;
|
||||||
|
|
||||||
QMap<GHeights, bool> GetGradationHeights() const;
|
QString GetAuthor() const;
|
||||||
void SetGradationHeights(const QMap<GHeights, bool> &options);
|
void SetAuthor(const QString &text);
|
||||||
|
|
||||||
QMap<GSizes, bool> GetGradationSizes() const;
|
virtual QString GenerateLabel(const LabelType &type)const;
|
||||||
void SetGradationSizes(const QMap<GSizes, bool> &options);
|
|
||||||
|
|
||||||
QString GetAuthor() const;
|
|
||||||
void SetAuthor(const QString &text);
|
|
||||||
|
|
||||||
QString GetDescription() const;
|
|
||||||
void SetDescription(const QString &text);
|
|
||||||
|
|
||||||
QString GetNotes() const;
|
|
||||||
void SetNotes(const QString &text);
|
|
||||||
|
|
||||||
QString GetVersion() const;
|
|
||||||
void SetVersion();
|
|
||||||
|
|
||||||
QString GenerateLabel(const LabelType &type)const;
|
|
||||||
|
|
||||||
quint32 SiblingNodeId(const quint32 &nodeId) const;
|
|
||||||
signals:
|
|
||||||
/**
|
|
||||||
* @brief ChangedActivDraw change active pattern peace.
|
|
||||||
* @param newName new pattern peace name.
|
|
||||||
*/
|
|
||||||
void ChangedActivPP(const QString &newName);
|
|
||||||
/**
|
|
||||||
* @brief ChangedNameDraw save new name pattern peace.
|
|
||||||
* @param oldName old name.
|
|
||||||
* @param newName new name.
|
|
||||||
*/
|
|
||||||
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile update tool data form file.
|
|
||||||
*/
|
|
||||||
void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief patternChanged emit if we have unsaved change.
|
|
||||||
*/
|
|
||||||
void patternChanged(bool saved);
|
|
||||||
/**
|
|
||||||
* @brief ShowTool highlight tool.
|
|
||||||
* @param id tool id.
|
|
||||||
* @param enable enable or disable highlight.
|
|
||||||
*/
|
|
||||||
void ShowTool(quint32 id, bool enable);
|
|
||||||
/**
|
|
||||||
* @brief ChangedCursor change cursor position.
|
|
||||||
* @param id tool id.
|
|
||||||
*/
|
|
||||||
void ChangedCursor(quint32 id);
|
|
||||||
void ClearMainWindow();
|
|
||||||
void UndoCommand();
|
|
||||||
void SetEnabledGUI(bool enabled);
|
|
||||||
void CheckLayout();
|
|
||||||
void SetCurrentPP(const QString &patterPiece);
|
|
||||||
public slots:
|
public slots:
|
||||||
void LiteParseTree(const Document &parse);
|
void LiteParseTree(const Document &parse);
|
||||||
void haveLiteChange();
|
|
||||||
void ShowHistoryTool(quint32 id, bool enable);
|
|
||||||
void NeedFullParsing();
|
|
||||||
void ClearScene();
|
|
||||||
protected:
|
protected:
|
||||||
virtual void customEvent(QEvent * event);
|
virtual void customEvent(QEvent * event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPattern)
|
Q_DISABLE_COPY(VPattern)
|
||||||
|
|
||||||
/** @brief data container with data. */
|
/** @brief data container with data. */
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
|
|
||||||
/** @brief nameActivDraw name current pattern peace. */
|
|
||||||
QString nameActivPP;
|
|
||||||
|
|
||||||
/** @brief tools list with pointer on tools. */
|
|
||||||
QHash<quint32, VDataTool*> tools;
|
|
||||||
|
|
||||||
/** @brief history history records. */
|
|
||||||
QVector<VToolRecord> history;
|
|
||||||
|
|
||||||
/** @brief cursor cursor keep id tool after which we will add new tool in file. */
|
|
||||||
quint32 cursor;
|
|
||||||
|
|
||||||
/** @brief patternPieces list of patern pieces names for combobox*/
|
|
||||||
QStringList patternPieces;
|
|
||||||
|
|
||||||
/** @brief mode current draw mode. */
|
/** @brief mode current draw mode. */
|
||||||
Draw *mode;
|
Draw *mode;
|
||||||
|
|
||||||
VMainGraphicsScene *sceneDraw;
|
VMainGraphicsScene *sceneDraw;
|
||||||
VMainGraphicsScene *sceneDetail;
|
VMainGraphicsScene *sceneDetail;
|
||||||
|
|
||||||
void SetActivPP(const QString& name);
|
|
||||||
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
||||||
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
||||||
void ParseDetailElement(const QDomElement &domElement,
|
void ParseDetailElement(const QDomElement &domElement,
|
||||||
|
@ -276,55 +114,7 @@ private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
|
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
|
||||||
void ParseCurrentPP();
|
void ParseCurrentPP();
|
||||||
void CheckTagExists(const QString &tag);
|
|
||||||
QString GetLabelBase(unsigned int index)const;
|
QString GetLabelBase(unsigned int index)const;
|
||||||
void ToolExists(const quint32 &id) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetNameActivPP return current pattern piece name.
|
|
||||||
* @return pattern piece name.
|
|
||||||
*/
|
|
||||||
inline QString VPattern::GetNameActivPP() const
|
|
||||||
{
|
|
||||||
return nameActivPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief getTools return list of tools pointers.
|
|
||||||
* @return list.
|
|
||||||
*/
|
|
||||||
inline QHash<quint32, VDataTool *> *VPattern::getTools()
|
|
||||||
{
|
|
||||||
return &tools;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief getHistory return list with list of history records.
|
|
||||||
* @return list of history records.
|
|
||||||
*/
|
|
||||||
inline QVector<VToolRecord> *VPattern::getHistory()
|
|
||||||
{
|
|
||||||
return &history;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief getCursor return cursor.
|
|
||||||
* @return cursor.
|
|
||||||
*/
|
|
||||||
inline quint32 VPattern::getCursor() const
|
|
||||||
{
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline QStringList VPattern::getPatternPieces() const
|
|
||||||
{
|
|
||||||
return patternPieces;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VPATTERN_H
|
#endif // VPATTERN_H
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "vstandardmeasurements.h"
|
#include "vstandardmeasurements.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "../core/vapplication.h"
|
#include "../core/vapplication.h"
|
||||||
|
#include "../../libs/vmisc/def.h"
|
||||||
|
|
||||||
const QString VStandardMeasurements::TagDescription = QStringLiteral("description");
|
const QString VStandardMeasurements::TagDescription = QStringLiteral("description");
|
||||||
const QString VStandardMeasurements::TagId = QStringLiteral("id");
|
const QString VStandardMeasurements::TagId = QStringLiteral("id");
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vexception.h"
|
#include "vexception.h"
|
||||||
#include "../../../utils/logging.h"
|
#include "../vmisc/logging.h"
|
||||||
#include "../../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
|
@ -31,7 +31,6 @@ CONFIG -= debug_and_release debug_and_release_target
|
||||||
DEFINES += QT_MESSAGELOGCONTEXT
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
include(ifc.pri)
|
include(ifc.pri)
|
||||||
include(../../utils/utils.pri)
|
|
||||||
|
|
||||||
# This is static library so no need in "make install"
|
# This is static library so no need in "make install"
|
||||||
|
|
||||||
|
|
|
@ -28,4 +28,32 @@
|
||||||
|
|
||||||
#include "ifcdef.h"
|
#include "ifcdef.h"
|
||||||
|
|
||||||
const qreal PrintDPI = 96.0;
|
#define DefWidth 1.2//mm
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal WidthMainLine(Unit patternUnit)
|
||||||
|
{
|
||||||
|
qreal _widthMainLine = DefWidth;
|
||||||
|
switch (patternUnit)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
_widthMainLine = DefWidth;
|
||||||
|
break;
|
||||||
|
case Unit::Cm:
|
||||||
|
_widthMainLine = DefWidth/10.0;
|
||||||
|
break;
|
||||||
|
case Unit::Inch:
|
||||||
|
_widthMainLine = DefWidth/25.4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_widthMainLine = DefWidth;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return _widthMainLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal WidthHairLine(Unit patternUnit)
|
||||||
|
{
|
||||||
|
return WidthMainLine(patternUnit)/3.0;
|
||||||
|
}
|
||||||
|
|
|
@ -30,15 +30,13 @@
|
||||||
#define IFCDEF_H
|
#define IFCDEF_H
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif /*Q_OS_WIN32*/
|
#endif /*Q_OS_WIN32*/
|
||||||
|
|
||||||
enum class Unit : char { Mm, Cm, Inch, Px };
|
|
||||||
enum class MeasurementsType : char { Standard, Individual };
|
|
||||||
|
|
||||||
static const quint32 null_id = 0;
|
static const quint32 null_id = 0;
|
||||||
|
|
||||||
#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value.
|
#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value.
|
||||||
|
@ -59,115 +57,7 @@ static const quint32 null_id = 0;
|
||||||
# define V_NOEXCEPT_EXPR(x)
|
# define V_NOEXCEPT_EXPR(x)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
extern const qreal PrintDPI;
|
qreal WidthMainLine(Unit patternUnit);
|
||||||
|
qreal WidthHairLine(Unit patternUnit);
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline double ToPixel(double val, const Unit &unit)
|
|
||||||
{
|
|
||||||
switch (unit)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
return (val / 25.4) * PrintDPI;
|
|
||||||
case Unit::Cm:
|
|
||||||
return ((val * 10.0) / 25.4) * PrintDPI;
|
|
||||||
case Unit::Inch:
|
|
||||||
return val * PrintDPI;
|
|
||||||
case Unit::Px:
|
|
||||||
return val;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline double FromPixel(double pix, const Unit &unit)
|
|
||||||
{
|
|
||||||
switch (unit)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
return (pix / PrintDPI) * 25.4;
|
|
||||||
case Unit::Cm:
|
|
||||||
return ((pix / PrintDPI) * 25.4) / 10.0;
|
|
||||||
case Unit::Inch:
|
|
||||||
return pix / PrintDPI;
|
|
||||||
case Unit::Px:
|
|
||||||
return pix;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)
|
|
||||||
{
|
|
||||||
switch (from)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
switch (to)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
return value;
|
|
||||||
case Unit::Cm:
|
|
||||||
return value / 10.0;
|
|
||||||
case Unit::Inch:
|
|
||||||
return value / 25.4;
|
|
||||||
case Unit::Px:
|
|
||||||
return (value / 25.4) * PrintDPI;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Unit::Cm:
|
|
||||||
switch (to)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
return value * 10.0;
|
|
||||||
case Unit::Cm:
|
|
||||||
return value;
|
|
||||||
case Unit::Inch:
|
|
||||||
return value / 2.54;
|
|
||||||
case Unit::Px:
|
|
||||||
return ((value * 10.0) / 25.4) * PrintDPI;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Unit::Inch:
|
|
||||||
switch (to)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
return value * 25.4;
|
|
||||||
case Unit::Cm:
|
|
||||||
return value * 2.54;
|
|
||||||
case Unit::Inch:
|
|
||||||
return value;
|
|
||||||
case Unit::Px:
|
|
||||||
return value * PrintDPI;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Unit::Px:
|
|
||||||
switch (to)
|
|
||||||
{
|
|
||||||
case Unit::Mm:
|
|
||||||
return (value / PrintDPI) * 25.4;
|
|
||||||
case Unit::Cm:
|
|
||||||
return ((value / PrintDPI) * 25.4) / 10.0;
|
|
||||||
case Unit::Inch:
|
|
||||||
return value / PrintDPI;
|
|
||||||
case Unit::Px:
|
|
||||||
return value;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // IFCDEF_H
|
#endif // IFCDEF_H
|
||||||
|
|
991
src/libs/ifc/xml/vabstractpattern.cpp
Normal file
991
src/libs/ifc/xml/vabstractpattern.cpp
Normal file
|
@ -0,0 +1,991 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vabstractpattern.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 15 6, 2015
|
||||||
|
**
|
||||||
|
** @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) 2015 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 "vabstractpattern.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
#include "exception/vexceptionbadid.h"
|
||||||
|
#include "vpatternconverter.h"
|
||||||
|
|
||||||
|
const QString VAbstractPattern::TagPattern = QStringLiteral("pattern");
|
||||||
|
const QString VAbstractPattern::TagCalculation = QStringLiteral("calculation");
|
||||||
|
const QString VAbstractPattern::TagModeling = QStringLiteral("modeling");
|
||||||
|
const QString VAbstractPattern::TagDetails = QStringLiteral("details");
|
||||||
|
const QString VAbstractPattern::TagAuthor = QStringLiteral("author");
|
||||||
|
const QString VAbstractPattern::TagDescription = QStringLiteral("description");
|
||||||
|
const QString VAbstractPattern::TagNotes = QStringLiteral("notes");
|
||||||
|
const QString VAbstractPattern::TagMeasurements = QStringLiteral("measurements");
|
||||||
|
const QString VAbstractPattern::TagIncrements = QStringLiteral("increments");
|
||||||
|
const QString VAbstractPattern::TagIncrement = QStringLiteral("increment");
|
||||||
|
const QString VAbstractPattern::TagDraw = QStringLiteral("draw");
|
||||||
|
const QString VAbstractPattern::TagPoint = QStringLiteral("point");
|
||||||
|
const QString VAbstractPattern::TagLine = QStringLiteral("line");
|
||||||
|
const QString VAbstractPattern::TagSpline = QStringLiteral("spline");
|
||||||
|
const QString VAbstractPattern::TagArc = QStringLiteral("arc");
|
||||||
|
const QString VAbstractPattern::TagTools = QStringLiteral("tools");
|
||||||
|
const QString VAbstractPattern::TagGradation = QStringLiteral("gradation");
|
||||||
|
const QString VAbstractPattern::TagHeights = QStringLiteral("heights");
|
||||||
|
const QString VAbstractPattern::TagSizes = QStringLiteral("sizes");
|
||||||
|
|
||||||
|
const QString VAbstractPattern::AttrName = QStringLiteral("name");
|
||||||
|
const QString VAbstractPattern::AttrType = QStringLiteral("type");
|
||||||
|
const QString VAbstractPattern::AttrPath = QStringLiteral("path");
|
||||||
|
|
||||||
|
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
|
||||||
|
|
||||||
|
const QString VAbstractPattern::AttrH92 = QStringLiteral("h92");
|
||||||
|
const QString VAbstractPattern::AttrH98 = QStringLiteral("h98");
|
||||||
|
const QString VAbstractPattern::AttrH104 = QStringLiteral("h104");
|
||||||
|
const QString VAbstractPattern::AttrH110 = QStringLiteral("h110");
|
||||||
|
const QString VAbstractPattern::AttrH116 = QStringLiteral("h116");
|
||||||
|
const QString VAbstractPattern::AttrH122 = QStringLiteral("h122");
|
||||||
|
const QString VAbstractPattern::AttrH128 = QStringLiteral("h128");
|
||||||
|
const QString VAbstractPattern::AttrH134 = QStringLiteral("h134");
|
||||||
|
const QString VAbstractPattern::AttrH140 = QStringLiteral("h140");
|
||||||
|
const QString VAbstractPattern::AttrH146 = QStringLiteral("h146");
|
||||||
|
const QString VAbstractPattern::AttrH152 = QStringLiteral("h152");
|
||||||
|
const QString VAbstractPattern::AttrH158 = QStringLiteral("h158");
|
||||||
|
const QString VAbstractPattern::AttrH164 = QStringLiteral("h164");
|
||||||
|
const QString VAbstractPattern::AttrH170 = QStringLiteral("h170");
|
||||||
|
const QString VAbstractPattern::AttrH176 = QStringLiteral("h176");
|
||||||
|
const QString VAbstractPattern::AttrH182 = QStringLiteral("h182");
|
||||||
|
const QString VAbstractPattern::AttrH188 = QStringLiteral("h188");
|
||||||
|
const QString VAbstractPattern::AttrH194 = QStringLiteral("h194");
|
||||||
|
|
||||||
|
const QString VAbstractPattern::AttrS22 = QStringLiteral("s22");
|
||||||
|
const QString VAbstractPattern::AttrS24 = QStringLiteral("s24");
|
||||||
|
const QString VAbstractPattern::AttrS26 = QStringLiteral("s26");
|
||||||
|
const QString VAbstractPattern::AttrS28 = QStringLiteral("s28");
|
||||||
|
const QString VAbstractPattern::AttrS30 = QStringLiteral("s30");
|
||||||
|
const QString VAbstractPattern::AttrS32 = QStringLiteral("s32");
|
||||||
|
const QString VAbstractPattern::AttrS34 = QStringLiteral("s34");
|
||||||
|
const QString VAbstractPattern::AttrS36 = QStringLiteral("s36");
|
||||||
|
const QString VAbstractPattern::AttrS38 = QStringLiteral("s38");
|
||||||
|
const QString VAbstractPattern::AttrS40 = QStringLiteral("s40");
|
||||||
|
const QString VAbstractPattern::AttrS42 = QStringLiteral("s42");
|
||||||
|
const QString VAbstractPattern::AttrS44 = QStringLiteral("s44");
|
||||||
|
const QString VAbstractPattern::AttrS46 = QStringLiteral("s46");
|
||||||
|
const QString VAbstractPattern::AttrS48 = QStringLiteral("s48");
|
||||||
|
const QString VAbstractPattern::AttrS50 = QStringLiteral("s50");
|
||||||
|
const QString VAbstractPattern::AttrS52 = QStringLiteral("s52");
|
||||||
|
const QString VAbstractPattern::AttrS54 = QStringLiteral("s54");
|
||||||
|
const QString VAbstractPattern::AttrS56 = QStringLiteral("s56");
|
||||||
|
|
||||||
|
const QString VAbstractPattern::IncrementName = QStringLiteral("name");
|
||||||
|
const QString VAbstractPattern::IncrementBase = QStringLiteral("base");
|
||||||
|
const QString VAbstractPattern::IncrementKsize = QStringLiteral("ksize");
|
||||||
|
const QString VAbstractPattern::IncrementKgrowth = QStringLiteral("kgrowth");
|
||||||
|
const QString VAbstractPattern::IncrementDescription = QStringLiteral("description");
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractPattern::VAbstractPattern(QObject *parent)
|
||||||
|
: QObject(parent), VDomDocument(), nameActivPP(QString()), cursor(0), tools(QHash<quint32, VDataTool*>()),
|
||||||
|
history(QVector<VToolRecord>()), patternPieces(QStringList())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractPattern::~VAbstractPattern()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ChangeActivPP set new active pattern piece name.
|
||||||
|
* @param name new name.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
*/
|
||||||
|
void VAbstractPattern::ChangeActivPP(const QString &name, const Document &parse)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(name.isEmpty() == false, "ChangeActivPP", "name pattern piece is empty");
|
||||||
|
if (CheckExistNamePP(name) && this->nameActivPP != name)
|
||||||
|
{
|
||||||
|
this->nameActivPP = name;
|
||||||
|
if (parse == Document::FullParse)
|
||||||
|
{
|
||||||
|
emit ChangedActivPP(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetNameActivPP return current pattern piece name.
|
||||||
|
* @return pattern piece name.
|
||||||
|
*/
|
||||||
|
QString VAbstractPattern::GetNameActivPP() const
|
||||||
|
{
|
||||||
|
return nameActivPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetActivDrawElement return draw tag for current pattern peace.
|
||||||
|
* @param element draw tag.
|
||||||
|
* @return true if found.
|
||||||
|
*/
|
||||||
|
bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const
|
||||||
|
{
|
||||||
|
if (nameActivPP.isEmpty() == false)
|
||||||
|
{
|
||||||
|
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
||||||
|
if (elements.size() == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for ( qint32 i = 0; i < elements.count(); i++ )
|
||||||
|
{
|
||||||
|
element = elements.at( i ).toElement();
|
||||||
|
if (element.isNull() == false)
|
||||||
|
{
|
||||||
|
const QString fieldName = element.attribute( AttrName );
|
||||||
|
if ( fieldName == nameActivPP )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element = QDomElement();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief CheckNameDraw check if exist pattern peace with this name.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
* @return true if exist.
|
||||||
|
*/
|
||||||
|
bool VAbstractPattern::CheckExistNamePP(const QString &name) const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty");
|
||||||
|
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
||||||
|
if (elements.size() == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for ( qint32 i = 0; i < elements.count(); i++ )
|
||||||
|
{
|
||||||
|
const QDomElement elem = elements.at( i ).toElement();
|
||||||
|
if (elem.isNull() == false)
|
||||||
|
{
|
||||||
|
if ( GetParametrString(elem, AttrName) == name )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetActivNodeElement find element in current pattern piece by name.
|
||||||
|
* @param name name tag.
|
||||||
|
* @param element element.
|
||||||
|
* @return true if found.
|
||||||
|
*/
|
||||||
|
bool VAbstractPattern::GetActivNodeElement(const QString &name, QDomElement &element) const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty");
|
||||||
|
QDomElement drawElement;
|
||||||
|
if (GetActivDrawElement(drawElement))
|
||||||
|
{
|
||||||
|
const QDomNodeList listElement = drawElement.elementsByTagName(name);
|
||||||
|
if (listElement.size() != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
element = listElement.at( 0 ).toElement();
|
||||||
|
if (element.isNull() == false)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VAbstractPattern::CountPP() const
|
||||||
|
{
|
||||||
|
const QDomElement rootElement = this->documentElement();
|
||||||
|
if (rootElement.isNull())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rootElement.elementsByTagName( TagDraw ).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QDomElement VAbstractPattern::GetPPElement(const QString &name)
|
||||||
|
{
|
||||||
|
if (name.isEmpty() == false)
|
||||||
|
{
|
||||||
|
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
||||||
|
if (elements.size() == 0)
|
||||||
|
{
|
||||||
|
return QDomElement();
|
||||||
|
}
|
||||||
|
for ( qint32 i = 0; i < elements.count(); i++ )
|
||||||
|
{
|
||||||
|
QDomElement element = elements.at( i ).toElement();
|
||||||
|
if (element.isNull() == false)
|
||||||
|
{
|
||||||
|
if ( element.attribute( AttrName ) == name )
|
||||||
|
{
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QDomElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ChangeNamePP change pattern piece name.
|
||||||
|
* @param oldName old pattern piece name.
|
||||||
|
* @param newName new pattern piece name.
|
||||||
|
* @return true if success.
|
||||||
|
*/
|
||||||
|
bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newName)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(newName.isEmpty() == false, "SetNamePP", "new name pattern piece is empty");
|
||||||
|
Q_ASSERT_X(oldName.isEmpty() == false, "SetNamePP", "old name pattern piece is empty");
|
||||||
|
|
||||||
|
if (CheckExistNamePP(oldName) == false)
|
||||||
|
{
|
||||||
|
qDebug()<<"Do not exist pattern piece with name"<<oldName;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckExistNamePP(newName))
|
||||||
|
{
|
||||||
|
qDebug()<<"Already exist pattern piece with name"<<newName;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement ppElement = GetPPElement(oldName);
|
||||||
|
if (ppElement.isElement())
|
||||||
|
{
|
||||||
|
if (nameActivPP == oldName)
|
||||||
|
{
|
||||||
|
nameActivPP = newName;
|
||||||
|
}
|
||||||
|
ppElement.setAttribute(AttrName, newName);
|
||||||
|
emit patternChanged(false);//For situation when we change name directly, without undocommands.
|
||||||
|
emit ChangedNameDraw(oldName, newName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't find pattern piece node with name"<<oldName<<Q_FUNC_INFO;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief appendPP add new pattern piece.
|
||||||
|
*
|
||||||
|
* Method check if not exist pattern piece with the same name and change name active pattern piece name, send signal
|
||||||
|
* about change pattern piece. Doen't add pattern piece to file structure. This task make SPoint tool.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
* @return true if success.
|
||||||
|
*/
|
||||||
|
bool VAbstractPattern::appendPP(const QString &name)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(name.isEmpty() == false, "appendPP", "name pattern piece is empty");
|
||||||
|
if (name.isEmpty())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (CheckExistNamePP(name) == false)
|
||||||
|
{
|
||||||
|
SetActivPP(name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VAbstractPattern::getCursor() const
|
||||||
|
{
|
||||||
|
return cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::setCursor(const quint32 &value)
|
||||||
|
{
|
||||||
|
if (cursor != value)
|
||||||
|
{
|
||||||
|
cursor = value;
|
||||||
|
emit ChangedCursor(cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getTool return tool from tool list.
|
||||||
|
* @param id tool id.
|
||||||
|
* @return tool.
|
||||||
|
*/
|
||||||
|
VDataTool *VAbstractPattern::getTool(const quint32 &id)
|
||||||
|
{
|
||||||
|
ToolExists(id);
|
||||||
|
return tools.value(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief AddTool add tool to list tools.
|
||||||
|
* @param id tool id.
|
||||||
|
* @param tool tool.
|
||||||
|
*/
|
||||||
|
void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
|
SCASSERT(tool != nullptr);
|
||||||
|
tools.insert(id, tool);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getHistory return list with list of history records.
|
||||||
|
* @return list of history records.
|
||||||
|
*/
|
||||||
|
QVector<VToolRecord> *VAbstractPattern::getHistory()
|
||||||
|
{
|
||||||
|
return &history;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
|
||||||
|
{
|
||||||
|
QVector<VToolRecord> historyPP;
|
||||||
|
for (qint32 i = 0; i< history.size(); ++i)
|
||||||
|
{
|
||||||
|
const VToolRecord tool = history.at(i);
|
||||||
|
if (tool.getNameDraw() != GetNameActivPP())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
historyPP.append(tool);
|
||||||
|
}
|
||||||
|
return historyPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::MPath() const
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(TagMeasurements);
|
||||||
|
QDomElement element = list.at(0).toElement();
|
||||||
|
if (element.isElement())
|
||||||
|
{
|
||||||
|
return GetParametrString(element, AttrPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetPath(const QString &path)
|
||||||
|
{
|
||||||
|
if (path.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug()<<"Path to measurements is empty"<<Q_FUNC_INFO;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QDomNodeList list = elementsByTagName(TagMeasurements);
|
||||||
|
QDomElement element = list.at(0).toElement();
|
||||||
|
if (element.isElement())
|
||||||
|
{
|
||||||
|
SetAttribute(element, AttrPath, path);
|
||||||
|
emit patternChanged(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save path to measurements"<<Q_FUNC_INFO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Unit VAbstractPattern::MUnit() const
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(VAbstractPattern::TagMeasurements);
|
||||||
|
QDomElement element = list.at(0).toElement();
|
||||||
|
if (element.isElement())
|
||||||
|
{
|
||||||
|
QStringList units = QStringList() <<"mm" << "cm" << "inch";
|
||||||
|
QString unit = GetParametrString(element, AttrUnit);
|
||||||
|
switch (units.indexOf(unit))
|
||||||
|
{
|
||||||
|
case 0:// mm
|
||||||
|
return Unit::Mm;
|
||||||
|
break;
|
||||||
|
case 1:// cm
|
||||||
|
return Unit::Cm;
|
||||||
|
break;
|
||||||
|
case 2:// in
|
||||||
|
return Unit::Inch;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return Unit::Cm;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unit::Cm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
MeasurementsType VAbstractPattern::MType() const
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(VAbstractPattern::TagMeasurements);
|
||||||
|
QDomElement element = list.at(0).toElement();
|
||||||
|
if (element.isElement())
|
||||||
|
{
|
||||||
|
QString type = GetParametrString(element, AttrType);
|
||||||
|
QStringList types = QStringList() << "standard" << "individual";
|
||||||
|
switch (types.indexOf(type))
|
||||||
|
{
|
||||||
|
case 0:// standard
|
||||||
|
return MeasurementsType::Standard;
|
||||||
|
break;
|
||||||
|
case 1:// individual
|
||||||
|
return MeasurementsType::Individual;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return MeasurementsType::Individual;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return MeasurementsType::Individual;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
|
||||||
|
{
|
||||||
|
quint32 siblingId = NULL_ID;
|
||||||
|
|
||||||
|
const QVector<VToolRecord> history = getLocalHistory();
|
||||||
|
for (qint32 i = 0; i < history.size(); ++i)
|
||||||
|
{
|
||||||
|
const VToolRecord tool = history.at(i);
|
||||||
|
if (nodeId == tool.getId())
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
siblingId = NULL_ID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (qint32 j = i; j > 0; --j)
|
||||||
|
{
|
||||||
|
const VToolRecord tool = history.at(j-1);
|
||||||
|
switch ( tool.getTypeTool() )
|
||||||
|
{
|
||||||
|
case Tool::Detail:
|
||||||
|
case Tool::UnionDetails:
|
||||||
|
case Tool::NodeArc:
|
||||||
|
case Tool::NodePoint:
|
||||||
|
case Tool::NodeSpline:
|
||||||
|
case Tool::NodeSplinePath:
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
siblingId = tool.getId();
|
||||||
|
j = 0;// break loop
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return siblingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList VAbstractPattern::getPatternPieces() const
|
||||||
|
{
|
||||||
|
return patternPieces;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMap<GHeights, bool> VAbstractPattern::GetGradationHeights() const
|
||||||
|
{
|
||||||
|
QMap<GHeights, bool> map;
|
||||||
|
map.insert(GHeights::ALL, true);
|
||||||
|
map.insert(GHeights::H92, true);
|
||||||
|
map.insert(GHeights::H98, true);
|
||||||
|
map.insert(GHeights::H104, true);
|
||||||
|
map.insert(GHeights::H110, true);
|
||||||
|
map.insert(GHeights::H116, true);
|
||||||
|
map.insert(GHeights::H122, true);
|
||||||
|
map.insert(GHeights::H128, true);
|
||||||
|
map.insert(GHeights::H134, true);
|
||||||
|
map.insert(GHeights::H140, true);
|
||||||
|
map.insert(GHeights::H146, true);
|
||||||
|
map.insert(GHeights::H152, true);
|
||||||
|
map.insert(GHeights::H158, true);
|
||||||
|
map.insert(GHeights::H164, true);
|
||||||
|
map.insert(GHeights::H170, true);
|
||||||
|
map.insert(GHeights::H176, true);
|
||||||
|
map.insert(GHeights::H182, true);
|
||||||
|
map.insert(GHeights::H188, true);
|
||||||
|
map.insert(GHeights::H194, true);
|
||||||
|
|
||||||
|
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||||
|
if (tags.size() == 0)
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||||
|
QDomNode domNode = tags.at(0).firstChild();
|
||||||
|
while (domNode.isNull() == false)
|
||||||
|
{
|
||||||
|
if (domNode.isElement())
|
||||||
|
{
|
||||||
|
const QDomElement domElement = domNode.toElement();
|
||||||
|
if (domElement.isNull() == false)
|
||||||
|
{
|
||||||
|
const QString defValue = QStringLiteral("true");
|
||||||
|
switch (gTags.indexOf(domElement.tagName()))
|
||||||
|
{
|
||||||
|
case 0: // TagHeights
|
||||||
|
if (GetParametrBool(domElement, AttrAll, defValue))
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map.insert(GHeights::ALL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.insert(GHeights::H92, GetParametrBool(domElement, AttrH92, defValue));
|
||||||
|
map.insert(GHeights::H98, GetParametrBool(domElement, AttrH98, defValue));
|
||||||
|
map.insert(GHeights::H104, GetParametrBool(domElement, AttrH104, defValue));
|
||||||
|
map.insert(GHeights::H110, GetParametrBool(domElement, AttrH110, defValue));
|
||||||
|
map.insert(GHeights::H116, GetParametrBool(domElement, AttrH116, defValue));
|
||||||
|
map.insert(GHeights::H122, GetParametrBool(domElement, AttrH122, defValue));
|
||||||
|
map.insert(GHeights::H128, GetParametrBool(domElement, AttrH128, defValue));
|
||||||
|
map.insert(GHeights::H134, GetParametrBool(domElement, AttrH134, defValue));
|
||||||
|
map.insert(GHeights::H140, GetParametrBool(domElement, AttrH140, defValue));
|
||||||
|
map.insert(GHeights::H146, GetParametrBool(domElement, AttrH146, defValue));
|
||||||
|
map.insert(GHeights::H152, GetParametrBool(domElement, AttrH152, defValue));
|
||||||
|
map.insert(GHeights::H158, GetParametrBool(domElement, AttrH158, defValue));
|
||||||
|
map.insert(GHeights::H164, GetParametrBool(domElement, AttrH164, defValue));
|
||||||
|
map.insert(GHeights::H170, GetParametrBool(domElement, AttrH170, defValue));
|
||||||
|
map.insert(GHeights::H176, GetParametrBool(domElement, AttrH176, defValue));
|
||||||
|
map.insert(GHeights::H182, GetParametrBool(domElement, AttrH182, defValue));
|
||||||
|
map.insert(GHeights::H188, GetParametrBool(domElement, AttrH188, defValue));
|
||||||
|
map.insert(GHeights::H194, GetParametrBool(domElement, AttrH194, defValue));
|
||||||
|
return map;
|
||||||
|
break;
|
||||||
|
case 1: // TagSizes
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
domNode = domNode.nextSibling();
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetGradationHeights(const QMap<GHeights, bool> &options)
|
||||||
|
{
|
||||||
|
CheckTagExists(TagGradation);
|
||||||
|
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||||
|
if (tags.size() == 0)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save tag "<<TagGradation<<Q_FUNC_INFO;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||||
|
QDomNode domNode = tags.at(0).firstChild();
|
||||||
|
while (domNode.isNull() == false)
|
||||||
|
{
|
||||||
|
if (domNode.isElement())
|
||||||
|
{
|
||||||
|
QDomElement domElement = domNode.toElement();
|
||||||
|
if (domElement.isNull() == false)
|
||||||
|
{
|
||||||
|
switch (gTags.indexOf(domElement.tagName()))
|
||||||
|
{
|
||||||
|
case 0: // TagHeights
|
||||||
|
SetAttribute(domElement, AttrAll, options.value(GHeights::ALL));
|
||||||
|
SetAttribute(domElement, AttrH92, options.value(GHeights::H92));
|
||||||
|
SetAttribute(domElement, AttrH98, options.value(GHeights::H98));
|
||||||
|
SetAttribute(domElement, AttrH104, options.value(GHeights::H104));
|
||||||
|
SetAttribute(domElement, AttrH110, options.value(GHeights::H110));
|
||||||
|
SetAttribute(domElement, AttrH116, options.value(GHeights::H116));
|
||||||
|
SetAttribute(domElement, AttrH122, options.value(GHeights::H122));
|
||||||
|
SetAttribute(domElement, AttrH128, options.value(GHeights::H128));
|
||||||
|
SetAttribute(domElement, AttrH134, options.value(GHeights::H134));
|
||||||
|
SetAttribute(domElement, AttrH140, options.value(GHeights::H140));
|
||||||
|
SetAttribute(domElement, AttrH146, options.value(GHeights::H146));
|
||||||
|
SetAttribute(domElement, AttrH152, options.value(GHeights::H152));
|
||||||
|
SetAttribute(domElement, AttrH158, options.value(GHeights::H158));
|
||||||
|
SetAttribute(domElement, AttrH164, options.value(GHeights::H164));
|
||||||
|
SetAttribute(domElement, AttrH170, options.value(GHeights::H170));
|
||||||
|
SetAttribute(domElement, AttrH176, options.value(GHeights::H176));
|
||||||
|
SetAttribute(domElement, AttrH182, options.value(GHeights::H182));
|
||||||
|
SetAttribute(domElement, AttrH188, options.value(GHeights::H188));
|
||||||
|
SetAttribute(domElement, AttrH194, options.value(GHeights::H194));
|
||||||
|
|
||||||
|
emit patternChanged(false);
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
case 1: // TagSizes
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
domNode = domNode.nextSibling();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMap<GSizes, bool> VAbstractPattern::GetGradationSizes() const
|
||||||
|
{
|
||||||
|
QMap<GSizes, bool> map;
|
||||||
|
map.insert(GSizes::ALL, true);
|
||||||
|
map.insert(GSizes::S22, true);
|
||||||
|
map.insert(GSizes::S24, true);
|
||||||
|
map.insert(GSizes::S26, true);
|
||||||
|
map.insert(GSizes::S28, true);
|
||||||
|
map.insert(GSizes::S30, true);
|
||||||
|
map.insert(GSizes::S32, true);
|
||||||
|
map.insert(GSizes::S34, true);
|
||||||
|
map.insert(GSizes::S36, true);
|
||||||
|
map.insert(GSizes::S38, true);
|
||||||
|
map.insert(GSizes::S40, true);
|
||||||
|
map.insert(GSizes::S42, true);
|
||||||
|
map.insert(GSizes::S44, true);
|
||||||
|
map.insert(GSizes::S46, true);
|
||||||
|
map.insert(GSizes::S48, true);
|
||||||
|
map.insert(GSizes::S50, true);
|
||||||
|
map.insert(GSizes::S52, true);
|
||||||
|
map.insert(GSizes::S54, true);
|
||||||
|
map.insert(GSizes::S56, true);
|
||||||
|
|
||||||
|
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||||
|
if (tags.size() == 0)
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||||
|
QDomNode domNode = tags.at(0).firstChild();
|
||||||
|
while (domNode.isNull() == false)
|
||||||
|
{
|
||||||
|
if (domNode.isElement())
|
||||||
|
{
|
||||||
|
const QDomElement domElement = domNode.toElement();
|
||||||
|
if (domElement.isNull() == false)
|
||||||
|
{
|
||||||
|
const QString defValue = QStringLiteral("true");
|
||||||
|
switch (gTags.indexOf(domElement.tagName()))
|
||||||
|
{
|
||||||
|
case 0: // TagHeights
|
||||||
|
break;
|
||||||
|
case 1: // TagSizes
|
||||||
|
if (GetParametrBool(domElement, AttrAll, defValue))
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map.insert(GSizes::ALL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.insert(GSizes::S22, GetParametrBool(domElement, AttrS22, defValue));
|
||||||
|
map.insert(GSizes::S24, GetParametrBool(domElement, AttrS24, defValue));
|
||||||
|
map.insert(GSizes::S26, GetParametrBool(domElement, AttrS26, defValue));
|
||||||
|
map.insert(GSizes::S28, GetParametrBool(domElement, AttrS28, defValue));
|
||||||
|
map.insert(GSizes::S30, GetParametrBool(domElement, AttrS30, defValue));
|
||||||
|
map.insert(GSizes::S32, GetParametrBool(domElement, AttrS32, defValue));
|
||||||
|
map.insert(GSizes::S34, GetParametrBool(domElement, AttrS34, defValue));
|
||||||
|
map.insert(GSizes::S36, GetParametrBool(domElement, AttrS36, defValue));
|
||||||
|
map.insert(GSizes::S38, GetParametrBool(domElement, AttrS38, defValue));
|
||||||
|
map.insert(GSizes::S40, GetParametrBool(domElement, AttrS40, defValue));
|
||||||
|
map.insert(GSizes::S42, GetParametrBool(domElement, AttrS42, defValue));
|
||||||
|
map.insert(GSizes::S44, GetParametrBool(domElement, AttrS44, defValue));
|
||||||
|
map.insert(GSizes::S46, GetParametrBool(domElement, AttrS46, defValue));
|
||||||
|
map.insert(GSizes::S48, GetParametrBool(domElement, AttrS48, defValue));
|
||||||
|
map.insert(GSizes::S50, GetParametrBool(domElement, AttrS50, defValue));
|
||||||
|
map.insert(GSizes::S52, GetParametrBool(domElement, AttrS52, defValue));
|
||||||
|
map.insert(GSizes::S54, GetParametrBool(domElement, AttrS54, defValue));
|
||||||
|
map.insert(GSizes::S56, GetParametrBool(domElement, AttrS56, defValue));
|
||||||
|
return map;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
domNode = domNode.nextSibling();
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetGradationSizes(const QMap<GSizes, bool> &options)
|
||||||
|
{
|
||||||
|
CheckTagExists(TagGradation);
|
||||||
|
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||||
|
if (tags.size() == 0)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save tag "<<TagGradation<<Q_FUNC_INFO;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||||
|
QDomNode domNode = tags.at(0).firstChild();
|
||||||
|
while (domNode.isNull() == false)
|
||||||
|
{
|
||||||
|
if (domNode.isElement())
|
||||||
|
{
|
||||||
|
QDomElement domElement = domNode.toElement();
|
||||||
|
if (domElement.isNull() == false)
|
||||||
|
{
|
||||||
|
switch (gTags.indexOf(domElement.tagName()))
|
||||||
|
{
|
||||||
|
case 0: // TagHeights
|
||||||
|
break;
|
||||||
|
case 1: // TagSizes
|
||||||
|
SetAttribute(domElement, AttrAll, options.value(GSizes::ALL));
|
||||||
|
SetAttribute(domElement, AttrS22, options.value(GSizes::S22));
|
||||||
|
SetAttribute(domElement, AttrS24, options.value(GSizes::S24));
|
||||||
|
SetAttribute(domElement, AttrS26, options.value(GSizes::S26));
|
||||||
|
SetAttribute(domElement, AttrS28, options.value(GSizes::S28));
|
||||||
|
SetAttribute(domElement, AttrS30, options.value(GSizes::S30));
|
||||||
|
SetAttribute(domElement, AttrS32, options.value(GSizes::S32));
|
||||||
|
SetAttribute(domElement, AttrS34, options.value(GSizes::S34));
|
||||||
|
SetAttribute(domElement, AttrS36, options.value(GSizes::S36));
|
||||||
|
SetAttribute(domElement, AttrS38, options.value(GSizes::S38));
|
||||||
|
SetAttribute(domElement, AttrS40, options.value(GSizes::S40));
|
||||||
|
SetAttribute(domElement, AttrS42, options.value(GSizes::S42));
|
||||||
|
SetAttribute(domElement, AttrS44, options.value(GSizes::S44));
|
||||||
|
SetAttribute(domElement, AttrS46, options.value(GSizes::S46));
|
||||||
|
SetAttribute(domElement, AttrS48, options.value(GSizes::S48));
|
||||||
|
SetAttribute(domElement, AttrS50, options.value(GSizes::S50));
|
||||||
|
SetAttribute(domElement, AttrS52, options.value(GSizes::S52));
|
||||||
|
SetAttribute(domElement, AttrS54, options.value(GSizes::S54));
|
||||||
|
SetAttribute(domElement, AttrS56, options.value(GSizes::S56));
|
||||||
|
|
||||||
|
emit patternChanged(false);
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
domNode = domNode.nextSibling();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::GetDescription() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetDescription(const QString &text)
|
||||||
|
{
|
||||||
|
CheckTagExists(TagDescription);
|
||||||
|
setTagText(TagDescription, text);
|
||||||
|
emit patternChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::GetNotes() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagNotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetNotes(const QString &text)
|
||||||
|
{
|
||||||
|
CheckTagExists(TagNotes);
|
||||||
|
setTagText(TagNotes, text);
|
||||||
|
emit patternChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::GetVersion() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagVersion, VPatternConverter::PatternMaxVerStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetVersion()
|
||||||
|
{
|
||||||
|
setTagText(TagVersion, VPatternConverter::PatternMaxVerStr);
|
||||||
|
emit patternChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief haveLiteChange we have unsaved change.
|
||||||
|
*/
|
||||||
|
void VAbstractPattern::haveLiteChange()
|
||||||
|
{
|
||||||
|
emit patternChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ShowHistoryTool hightlight tool.
|
||||||
|
* @param id tool id.
|
||||||
|
* @param enable enable or diasable hightlight.
|
||||||
|
*/
|
||||||
|
void VAbstractPattern::ShowHistoryTool(quint32 id, bool enable)
|
||||||
|
{
|
||||||
|
emit ShowTool(id, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::NeedFullParsing()
|
||||||
|
{
|
||||||
|
emit UndoCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::ClearScene()
|
||||||
|
{
|
||||||
|
emit ClearMainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::ToolExists(const quint32 &id) const
|
||||||
|
{
|
||||||
|
if (tools.contains(id) == false)
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't find tool in table."), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief SetActivPP set current pattern piece.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
*/
|
||||||
|
void VAbstractPattern::SetActivPP(const QString &name)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(name.isEmpty() == false, "SetActivPP", "name pattern piece is empty");
|
||||||
|
this->nameActivPP = name;
|
||||||
|
emit ChangedActivPP(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::CheckTagExists(const QString &tag)
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(tag);
|
||||||
|
if (list.size() == 0)
|
||||||
|
{
|
||||||
|
QStringList tags = QStringList() << TagVersion << TagAuthor << TagDescription << TagNotes << TagGradation;
|
||||||
|
QDomElement pattern = documentElement();
|
||||||
|
switch (tags.indexOf(tag))
|
||||||
|
{
|
||||||
|
case 0: //TagVersion
|
||||||
|
break;// Mandatory tag
|
||||||
|
case 1: //TagAuthor
|
||||||
|
pattern.insertAfter(createElement(TagAuthor), elementsByTagName(TagVersion).at(0));
|
||||||
|
SetVersion();
|
||||||
|
break;
|
||||||
|
case 2: //TagDescription
|
||||||
|
{
|
||||||
|
for (int i = tags.indexOf(tag)-1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(tags.at(i));
|
||||||
|
if (list.isEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pattern.insertAfter(createElement(TagDescription), list.at(0));
|
||||||
|
}
|
||||||
|
SetVersion();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: //TagNotes
|
||||||
|
{
|
||||||
|
for (int i = tags.indexOf(tag)-1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(tags.at(i));
|
||||||
|
if (list.isEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pattern.insertAfter(createElement(TagNotes), list.at(0));
|
||||||
|
}
|
||||||
|
SetVersion();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: //TagGradation
|
||||||
|
{
|
||||||
|
QDomElement gradation = createElement(TagGradation);
|
||||||
|
gradation.appendChild(createElement(TagHeights));
|
||||||
|
gradation.appendChild(createElement(TagSizes));
|
||||||
|
|
||||||
|
for (int i = tags.indexOf(tag)-1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(tags.at(i));
|
||||||
|
if (list.isEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pattern.insertAfter(gradation, list.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SetVersion();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
257
src/libs/ifc/xml/vabstractpattern.h
Normal file
257
src/libs/ifc/xml/vabstractpattern.h
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vabstractpattern.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 15 6, 2015
|
||||||
|
**
|
||||||
|
** @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) 2015 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 VABSTRACTPATTERN_H
|
||||||
|
#define VABSTRACTPATTERN_H
|
||||||
|
|
||||||
|
#include "vdomdocument.h"
|
||||||
|
#include "vtoolrecord.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
||||||
|
enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2};
|
||||||
|
enum class LabelType : char {NewPatternPiece, NewLabel};
|
||||||
|
|
||||||
|
class VDataTool;
|
||||||
|
class VContainer;
|
||||||
|
|
||||||
|
class VAbstractPattern : public QObject, public VDomDocument
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VAbstractPattern(QObject *parent = nullptr);
|
||||||
|
virtual ~VAbstractPattern();
|
||||||
|
|
||||||
|
virtual void CreateEmptyFile(const QString &tablePath)=0;
|
||||||
|
|
||||||
|
void ChangeActivPP(const QString& name, const Document &parse = Document::FullParse);
|
||||||
|
QString GetNameActivPP() const;
|
||||||
|
bool CheckExistNamePP(const QString& name) const;
|
||||||
|
int CountPP() const;
|
||||||
|
QDomElement GetPPElement(const QString &name);
|
||||||
|
bool ChangeNamePP(const QString& oldName, const QString &newName);
|
||||||
|
bool appendPP(const QString& name);
|
||||||
|
|
||||||
|
bool GetActivDrawElement(QDomElement &element) const;
|
||||||
|
bool GetActivNodeElement(const QString& name, QDomElement& element) const;
|
||||||
|
|
||||||
|
quint32 getCursor() const;
|
||||||
|
void setCursor(const quint32 &value);
|
||||||
|
|
||||||
|
virtual void IncrementReferens(quint32 id) const=0;
|
||||||
|
virtual void DecrementReferens(quint32 id) const=0;
|
||||||
|
|
||||||
|
virtual QString GenerateLabel(const LabelType &type)const=0;
|
||||||
|
|
||||||
|
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;
|
||||||
|
|
||||||
|
QHash<quint32, VDataTool *> *getTools();
|
||||||
|
VDataTool *getTool(const quint32 &id);
|
||||||
|
void AddTool(const quint32 &id, VDataTool *tool);
|
||||||
|
|
||||||
|
QVector<VToolRecord> *getHistory();
|
||||||
|
QVector<VToolRecord> getLocalHistory() const;
|
||||||
|
|
||||||
|
QString MPath() const;
|
||||||
|
void SetPath(const QString &path);
|
||||||
|
Unit MUnit() const;
|
||||||
|
MeasurementsType MType() const;
|
||||||
|
|
||||||
|
quint32 SiblingNodeId(const quint32 &nodeId) const;
|
||||||
|
|
||||||
|
QStringList getPatternPieces() const;
|
||||||
|
|
||||||
|
QMap<GHeights, bool> GetGradationHeights() const;
|
||||||
|
void SetGradationHeights(const QMap<GHeights, bool> &options);
|
||||||
|
|
||||||
|
QMap<GSizes, bool> GetGradationSizes() const;
|
||||||
|
void SetGradationSizes(const QMap<GSizes, bool> &options);
|
||||||
|
|
||||||
|
QString GetDescription() const;
|
||||||
|
void SetDescription(const QString &text);
|
||||||
|
|
||||||
|
QString GetNotes() const;
|
||||||
|
void SetNotes(const QString &text);
|
||||||
|
|
||||||
|
QString GetVersion() const;
|
||||||
|
void SetVersion();
|
||||||
|
|
||||||
|
static const QString TagPattern;
|
||||||
|
static const QString TagCalculation;
|
||||||
|
static const QString TagModeling;
|
||||||
|
static const QString TagDetails;
|
||||||
|
static const QString TagAuthor;
|
||||||
|
static const QString TagDescription;
|
||||||
|
static const QString TagNotes;
|
||||||
|
static const QString TagMeasurements;
|
||||||
|
static const QString TagIncrements;
|
||||||
|
static const QString TagIncrement;
|
||||||
|
static const QString TagDraw;
|
||||||
|
static const QString TagPoint;
|
||||||
|
static const QString TagLine;
|
||||||
|
static const QString TagSpline;
|
||||||
|
static const QString TagArc;
|
||||||
|
static const QString TagTools;
|
||||||
|
static const QString TagGradation;
|
||||||
|
static const QString TagHeights;
|
||||||
|
static const QString TagSizes;
|
||||||
|
|
||||||
|
static const QString AttrName;
|
||||||
|
static const QString AttrType;
|
||||||
|
static const QString AttrPath;
|
||||||
|
|
||||||
|
static const QString AttrAll;
|
||||||
|
|
||||||
|
static const QString AttrH92;
|
||||||
|
static const QString AttrH98;
|
||||||
|
static const QString AttrH104;
|
||||||
|
static const QString AttrH110;
|
||||||
|
static const QString AttrH116;
|
||||||
|
static const QString AttrH122;
|
||||||
|
static const QString AttrH128;
|
||||||
|
static const QString AttrH134;
|
||||||
|
static const QString AttrH140;
|
||||||
|
static const QString AttrH146;
|
||||||
|
static const QString AttrH152;
|
||||||
|
static const QString AttrH158;
|
||||||
|
static const QString AttrH164;
|
||||||
|
static const QString AttrH170;
|
||||||
|
static const QString AttrH176;
|
||||||
|
static const QString AttrH182;
|
||||||
|
static const QString AttrH188;
|
||||||
|
static const QString AttrH194;
|
||||||
|
|
||||||
|
static const QString AttrS22;
|
||||||
|
static const QString AttrS24;
|
||||||
|
static const QString AttrS26;
|
||||||
|
static const QString AttrS28;
|
||||||
|
static const QString AttrS30;
|
||||||
|
static const QString AttrS32;
|
||||||
|
static const QString AttrS34;
|
||||||
|
static const QString AttrS36;
|
||||||
|
static const QString AttrS38;
|
||||||
|
static const QString AttrS40;
|
||||||
|
static const QString AttrS42;
|
||||||
|
static const QString AttrS44;
|
||||||
|
static const QString AttrS46;
|
||||||
|
static const QString AttrS48;
|
||||||
|
static const QString AttrS50;
|
||||||
|
static const QString AttrS52;
|
||||||
|
static const QString AttrS54;
|
||||||
|
static const QString AttrS56;
|
||||||
|
|
||||||
|
static const QString IncrementName;
|
||||||
|
static const QString IncrementBase;
|
||||||
|
static const QString IncrementKsize;
|
||||||
|
static const QString IncrementKgrowth;
|
||||||
|
static const QString IncrementDescription;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief ChangedActivDraw change active pattern peace.
|
||||||
|
* @param newName new pattern peace name.
|
||||||
|
*/
|
||||||
|
void ChangedActivPP(const QString &newName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ChangedCursor change cursor position.
|
||||||
|
* @param id tool id.
|
||||||
|
*/
|
||||||
|
void ChangedCursor(quint32 id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ChangedNameDraw save new name pattern peace.
|
||||||
|
* @param oldName old name.
|
||||||
|
* @param newName new name.
|
||||||
|
*/
|
||||||
|
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
||||||
|
/**
|
||||||
|
* @brief FullUpdateFromFile update tool data form file.
|
||||||
|
*/
|
||||||
|
void FullUpdateFromFile();
|
||||||
|
/**
|
||||||
|
* @brief patternChanged emit if we have unsaved change.
|
||||||
|
*/
|
||||||
|
void patternChanged(bool saved);
|
||||||
|
/**
|
||||||
|
* @brief ShowTool highlight tool.
|
||||||
|
* @param id tool id.
|
||||||
|
* @param enable enable or disable highlight.
|
||||||
|
*/
|
||||||
|
void ShowTool(quint32 id, bool enable);
|
||||||
|
void ClearMainWindow();
|
||||||
|
void UndoCommand();
|
||||||
|
void SetEnabledGUI(bool enabled);
|
||||||
|
void CheckLayout();
|
||||||
|
void SetCurrentPP(const QString &patterPiece);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void LiteParseTree(const Document &parse)=0;
|
||||||
|
void haveLiteChange();
|
||||||
|
void ShowHistoryTool(quint32 id, bool enable);
|
||||||
|
void NeedFullParsing();
|
||||||
|
void ClearScene();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** @brief nameActivDraw name current pattern peace. */
|
||||||
|
QString nameActivPP;
|
||||||
|
|
||||||
|
/** @brief cursor cursor keep id tool after which we will add new tool in file. */
|
||||||
|
quint32 cursor;
|
||||||
|
|
||||||
|
/** @brief tools list with pointer on tools. */
|
||||||
|
QHash<quint32, VDataTool*> tools;
|
||||||
|
|
||||||
|
/** @brief history history records. */
|
||||||
|
QVector<VToolRecord> history;
|
||||||
|
|
||||||
|
/** @brief patternPieces list of patern pieces names for combobox*/
|
||||||
|
QStringList patternPieces;
|
||||||
|
|
||||||
|
void ToolExists(const quint32 &id) const;
|
||||||
|
|
||||||
|
void SetActivPP(const QString& name);
|
||||||
|
|
||||||
|
void CheckTagExists(const QString &tag);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VAbstractPattern)
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getTools return list of tools pointers.
|
||||||
|
* @return list.
|
||||||
|
*/
|
||||||
|
inline QHash<quint32, VDataTool *> *VAbstractPattern::getTools()
|
||||||
|
{
|
||||||
|
return &tools;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VABSTRACTPATTERN_H
|
|
@ -33,8 +33,9 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../../../utils/logging.h"
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vmisc/logging.h"
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(vXML)
|
Q_DECLARE_LOGGING_CATEGORY(vXML)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef VTOOLRECORD_H
|
#ifndef VTOOLRECORD_H
|
||||||
#define VTOOLRECORD_H
|
#define VTOOLRECORD_H
|
||||||
|
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,12 @@ HEADERS += \
|
||||||
$$PWD/vabstractconverter.h \
|
$$PWD/vabstractconverter.h \
|
||||||
$$PWD/vdomdocument.h \
|
$$PWD/vdomdocument.h \
|
||||||
$$PWD/vpatternconverter.h \
|
$$PWD/vpatternconverter.h \
|
||||||
$$PWD/vtoolrecord.h
|
$$PWD/vtoolrecord.h \
|
||||||
|
xml/vabstractpattern.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/vabstractconverter.cpp \
|
$$PWD/vabstractconverter.cpp \
|
||||||
$$PWD/vdomdocument.cpp \
|
$$PWD/vdomdocument.cpp \
|
||||||
$$PWD/vpatternconverter.cpp \
|
$$PWD/vpatternconverter.cpp \
|
||||||
$$PWD/vtoolrecord.cpp
|
$$PWD/vtoolrecord.cpp \
|
||||||
|
xml/vabstractpattern.cpp
|
||||||
|
|
|
@ -6,6 +6,7 @@ SUBDIRS = \
|
||||||
vobj \
|
vobj \
|
||||||
vlayout \
|
vlayout \
|
||||||
vgeometry \
|
vgeometry \
|
||||||
vpatterndb
|
vpatterndb \
|
||||||
|
vmisc \
|
||||||
vgeometry.depends = ifc
|
vwidgets \
|
||||||
|
vtools
|
||||||
|
|
|
@ -25,7 +25,6 @@ CONFIG -= debug_and_release debug_and_release_target
|
||||||
DEFINES += QT_MESSAGELOGCONTEXT
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
include(vgeometry.pri)
|
include(vgeometry.pri)
|
||||||
include(../../utils/utils.pri)
|
|
||||||
|
|
||||||
# This is static library so no need in "make install"
|
# This is static library so no need in "make install"
|
||||||
|
|
||||||
|
@ -95,12 +94,3 @@ CONFIG(debug, debug|release){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# IFC static library
|
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../ifc/$${DESTDIR}/ -lifc
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../ifc
|
|
||||||
DEPENDPATH += $$PWD/../ifc
|
|
||||||
|
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../ifc/$${DESTDIR}/ifc.lib
|
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../ifc/$${DESTDIR}/libifc.a
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,6 @@ CONFIG -= debug_and_release debug_and_release_target
|
||||||
DEFINES += QT_MESSAGELOGCONTEXT
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
include(vlayout.pri)
|
include(vlayout.pri)
|
||||||
include(../../utils/utils.pri)
|
|
||||||
|
|
||||||
# This is static library so no need in "make install"
|
# This is static library so no need in "make install"
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vposition.h"
|
#include "vposition.h"
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,12 +30,12 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPoster::VPoster(const QPrinter *printer)
|
VPoster::VPoster(const QPrinter *printer)
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
// Keep synchronize all names with initialization in VApllication class!!!!!
|
// Keep synchronize all names with initialization in VApllication class!!!!!
|
||||||
//measurements
|
//measurements
|
||||||
//head and neck
|
//head and neck
|
||||||
|
@ -216,3 +218,172 @@ const QStringList builInFunctions = QStringList() << sin_F << cos_F << tan_F
|
||||||
const QString cm_Oprt = QStringLiteral("cm");
|
const QString cm_Oprt = QStringLiteral("cm");
|
||||||
const QString mm_Oprt = QStringLiteral("mm");
|
const QString mm_Oprt = QStringLiteral("mm");
|
||||||
const QString in_Oprt = QStringLiteral("in");
|
const QString in_Oprt = QStringLiteral("in");
|
||||||
|
|
||||||
|
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
|
||||||
|
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
|
||||||
|
|
||||||
|
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
|
||||||
|
// furthermore blows up the binary sizes.
|
||||||
|
const QString degreeSymbol = QStringLiteral("°");
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void SetOverrideCursor(const QString &pixmapPath, int hotX, int hotY)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap oldPixmap;
|
||||||
|
if (QCursor *oldCursor = QGuiApplication::overrideCursor())
|
||||||
|
{
|
||||||
|
oldPixmap = oldCursor->pixmap();
|
||||||
|
}
|
||||||
|
QPixmap newPixmap(pixmapPath);
|
||||||
|
|
||||||
|
QImage oldImage = oldPixmap.toImage();
|
||||||
|
QImage newImage = newPixmap.toImage();
|
||||||
|
|
||||||
|
if (oldImage != newImage )
|
||||||
|
{
|
||||||
|
QApplication::setOverrideCursor(QCursor(newPixmap, hotX, hotY));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void RestoreOverrideCursor(const QString &pixmapPath)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap oldPixmap;
|
||||||
|
if (QCursor *oldCursor = QGuiApplication::overrideCursor())
|
||||||
|
{
|
||||||
|
oldPixmap = oldCursor->pixmap();
|
||||||
|
}
|
||||||
|
QPixmap newPixmap(pixmapPath);
|
||||||
|
|
||||||
|
QImage oldImage = oldPixmap.toImage();
|
||||||
|
QImage newImage = newPixmap.toImage();
|
||||||
|
|
||||||
|
if (oldImage == newImage )
|
||||||
|
{
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
const qreal PrintDPI = 96.0;
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
double ToPixel(double val, const Unit &unit)
|
||||||
|
{
|
||||||
|
switch (unit)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return (val / 25.4) * PrintDPI;
|
||||||
|
case Unit::Cm:
|
||||||
|
return ((val * 10.0) / 25.4) * PrintDPI;
|
||||||
|
case Unit::Inch:
|
||||||
|
return val * PrintDPI;
|
||||||
|
case Unit::Px:
|
||||||
|
return val;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
double FromPixel(double pix, const Unit &unit)
|
||||||
|
{
|
||||||
|
switch (unit)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return (pix / PrintDPI) * 25.4;
|
||||||
|
case Unit::Cm:
|
||||||
|
return ((pix / PrintDPI) * 25.4) / 10.0;
|
||||||
|
case Unit::Inch:
|
||||||
|
return pix / PrintDPI;
|
||||||
|
case Unit::Px:
|
||||||
|
return pix;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)
|
||||||
|
{
|
||||||
|
switch (from)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
switch (to)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return value;
|
||||||
|
case Unit::Cm:
|
||||||
|
return value / 10.0;
|
||||||
|
case Unit::Inch:
|
||||||
|
return value / 25.4;
|
||||||
|
case Unit::Px:
|
||||||
|
return (value / 25.4) * PrintDPI;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Unit::Cm:
|
||||||
|
switch (to)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return value * 10.0;
|
||||||
|
case Unit::Cm:
|
||||||
|
return value;
|
||||||
|
case Unit::Inch:
|
||||||
|
return value / 2.54;
|
||||||
|
case Unit::Px:
|
||||||
|
return ((value * 10.0) / 25.4) * PrintDPI;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Unit::Inch:
|
||||||
|
switch (to)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return value * 25.4;
|
||||||
|
case Unit::Cm:
|
||||||
|
return value * 2.54;
|
||||||
|
case Unit::Inch:
|
||||||
|
return value;
|
||||||
|
case Unit::Px:
|
||||||
|
return value * PrintDPI;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Unit::Px:
|
||||||
|
switch (to)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return (value / PrintDPI) * 25.4;
|
||||||
|
case Unit::Cm:
|
||||||
|
return ((value / PrintDPI) * 25.4) / 10.0;
|
||||||
|
case Unit::Inch:
|
||||||
|
return value / PrintDPI;
|
||||||
|
case Unit::Px:
|
||||||
|
return value;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CheckFactor(qreal &oldFactor, const qreal &Newfactor)
|
||||||
|
{
|
||||||
|
if (Newfactor <= 2 && Newfactor >= 0.5)
|
||||||
|
{
|
||||||
|
oldFactor = Newfactor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,7 +33,14 @@
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
#define SceneSize 50000
|
||||||
|
#define DefPointRadius 1.5//mm
|
||||||
|
|
||||||
enum class NodeDetail : char { Contour, Modeling };
|
enum class NodeDetail : char { Contour, Modeling };
|
||||||
|
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
|
||||||
|
enum class MeasurementsType : char { Standard, Individual };
|
||||||
|
enum class Unit : char { Mm, Cm, Inch, Px };
|
||||||
|
enum class Source : char { FromGui, FromFile, FromTool };
|
||||||
|
|
||||||
enum class Tool : unsigned char
|
enum class Tool : unsigned char
|
||||||
{
|
{
|
||||||
|
@ -367,4 +374,21 @@ extern const QString cm_Oprt;
|
||||||
extern const QString mm_Oprt;
|
extern const QString mm_Oprt;
|
||||||
extern const QString in_Oprt;
|
extern const QString in_Oprt;
|
||||||
|
|
||||||
|
extern const QString cursorArrowOpenHand;
|
||||||
|
extern const QString cursorArrowCloseHand;
|
||||||
|
|
||||||
|
extern const QString degreeSymbol;
|
||||||
|
|
||||||
|
void SetOverrideCursor(const QString & pixmapPath, int hotX = -1, int hotY = -1);
|
||||||
|
void RestoreOverrideCursor(const QString & pixmapPath);
|
||||||
|
|
||||||
|
extern const qreal PrintDPI;
|
||||||
|
|
||||||
|
double ToPixel(double val, const Unit &unit);
|
||||||
|
double FromPixel(double pix, const Unit &unit);
|
||||||
|
|
||||||
|
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to);
|
||||||
|
|
||||||
|
void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
|
||||||
|
|
||||||
#endif // DEF_H
|
#endif // DEF_H
|
30
src/libs/vmisc/stable.cpp
Normal file
30
src/libs/vmisc/stable.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file stable.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 10 12, 2014
|
||||||
|
**
|
||||||
|
** @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) 2013-2015 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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
// Build the precompiled headers.
|
||||||
|
#include "stable.h"
|
52
src/libs/vmisc/stable.h
Normal file
52
src/libs/vmisc/stable.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file stable.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 10 12, 2014
|
||||||
|
**
|
||||||
|
** @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) 2013-2015 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 STABLE_H
|
||||||
|
#define STABLE_H
|
||||||
|
|
||||||
|
/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */
|
||||||
|
#ifndef __clang__
|
||||||
|
#pragma message("Compiling precompiled headers for VMisc library.\n")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Add C includes here */
|
||||||
|
|
||||||
|
#if defined __cplusplus
|
||||||
|
/* Add C++ includes here */
|
||||||
|
|
||||||
|
#ifdef QT_CORE_LIB
|
||||||
|
#include <QtCore>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef QT_GUI_LIB
|
||||||
|
# include <QtGui>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif/*__cplusplus*/
|
||||||
|
|
||||||
|
#endif // STABLE_H
|
127
src/libs/vmisc/vabstractapplication.cpp
Normal file
127
src/libs/vmisc/vabstractapplication.cpp
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vabstractapplication.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 18 6, 2015
|
||||||
|
**
|
||||||
|
** @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) 2015 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 "vabstractapplication.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
||||||
|
:QApplication(argc, argv),
|
||||||
|
undoStack(nullptr),
|
||||||
|
mainWindow(nullptr),
|
||||||
|
_patternUnit(Unit::Cm),
|
||||||
|
_patternType(MeasurementsType::Individual),
|
||||||
|
settings(nullptr),
|
||||||
|
currentScene(nullptr),
|
||||||
|
sceneView(nullptr),
|
||||||
|
doc(nullptr),
|
||||||
|
openingPattern(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractApplication::~VAbstractApplication()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Unit VAbstractApplication::patternUnit() const
|
||||||
|
{
|
||||||
|
return _patternUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const Unit *VAbstractApplication::patternUnitP() const
|
||||||
|
{
|
||||||
|
return &_patternUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractApplication::setPatternUnit(const Unit &patternUnit)
|
||||||
|
{
|
||||||
|
_patternUnit = patternUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief OpenSettings get acsses to application settings.
|
||||||
|
*
|
||||||
|
* Because we can create object in constructor we open file separately.
|
||||||
|
*/
|
||||||
|
void VAbstractApplication::OpenSettings()
|
||||||
|
{
|
||||||
|
settings = new VSettings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getSettings hide settings constructor.
|
||||||
|
* @return pointer to class for acssesing to settings in ini file.
|
||||||
|
*/
|
||||||
|
VSettings *VAbstractApplication::Settings()
|
||||||
|
{
|
||||||
|
SCASSERT(settings != nullptr);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGraphicsScene *VAbstractApplication::getCurrentScene() const
|
||||||
|
{
|
||||||
|
SCASSERT(currentScene != nullptr);
|
||||||
|
return currentScene;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractApplication::setCurrentScene(QGraphicsScene *value)
|
||||||
|
{
|
||||||
|
currentScene = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VMainGraphicsView *VAbstractApplication::getSceneView() const
|
||||||
|
{
|
||||||
|
return sceneView;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractApplication::setSceneView(VMainGraphicsView *value)
|
||||||
|
{
|
||||||
|
sceneView = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
double VAbstractApplication::toPixel(double val) const
|
||||||
|
{
|
||||||
|
return ToPixel(val, _patternUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
double VAbstractApplication::fromPixel(double pix) const
|
||||||
|
{
|
||||||
|
return FromPixel(pix, _patternUnit);
|
||||||
|
}
|
184
src/libs/vmisc/vabstractapplication.h
Normal file
184
src/libs/vmisc/vabstractapplication.h
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vabstractapplication.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 18 6, 2015
|
||||||
|
**
|
||||||
|
** @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) 2015 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 VABSTRACTAPPLICATION_H
|
||||||
|
#define VABSTRACTAPPLICATION_H
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include "def.h"
|
||||||
|
#include "vsettings.h"
|
||||||
|
|
||||||
|
class VAbstractApplication;// use in define
|
||||||
|
class VTranslateVars;
|
||||||
|
class VAbstractPattern;
|
||||||
|
class VMainGraphicsView;
|
||||||
|
class QUndoStack;
|
||||||
|
|
||||||
|
#if defined(qApp)
|
||||||
|
#undef qApp
|
||||||
|
#endif
|
||||||
|
#define qApp (static_cast<VAbstractApplication*>(QCoreApplication::instance()))
|
||||||
|
|
||||||
|
class VAbstractApplication : public QApplication
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VAbstractApplication(int &argc, char ** argv);
|
||||||
|
virtual ~VAbstractApplication();
|
||||||
|
|
||||||
|
virtual const VTranslateVars *TrVars()=0;
|
||||||
|
|
||||||
|
Unit patternUnit() const;
|
||||||
|
const Unit *patternUnitP() const;
|
||||||
|
void setPatternUnit(const Unit &patternUnit);
|
||||||
|
|
||||||
|
MeasurementsType patternType() const;
|
||||||
|
void setPatternType(const MeasurementsType &patternType);
|
||||||
|
|
||||||
|
void OpenSettings();
|
||||||
|
VSettings *Settings();
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
QString LocaleToString(const T &value);
|
||||||
|
|
||||||
|
QGraphicsScene *getCurrentScene() const;
|
||||||
|
void setCurrentScene(QGraphicsScene *value);
|
||||||
|
|
||||||
|
VMainGraphicsView *getSceneView() const;
|
||||||
|
void setSceneView(VMainGraphicsView *value);
|
||||||
|
|
||||||
|
double toPixel(double val) const;
|
||||||
|
double fromPixel(double pix) const;
|
||||||
|
|
||||||
|
void setCurrentDocument(VAbstractPattern *doc);
|
||||||
|
VAbstractPattern *getCurrentDocument()const;
|
||||||
|
|
||||||
|
bool getOpeningPattern() const;
|
||||||
|
void setOpeningPattern();
|
||||||
|
|
||||||
|
QWidget *getMainWindow() const;
|
||||||
|
void setMainWindow(QWidget *value);
|
||||||
|
|
||||||
|
QUndoStack *getUndoStack() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QUndoStack *undoStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
||||||
|
* modality doesn't work.
|
||||||
|
*/
|
||||||
|
QWidget *mainWindow;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VAbstractApplication)
|
||||||
|
Unit _patternUnit;
|
||||||
|
MeasurementsType _patternType;
|
||||||
|
/**
|
||||||
|
* @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable.
|
||||||
|
*/
|
||||||
|
VSettings *settings;
|
||||||
|
|
||||||
|
QGraphicsScene *currentScene;
|
||||||
|
VMainGraphicsView *sceneView;
|
||||||
|
|
||||||
|
VAbstractPattern *doc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
|
||||||
|
* we can allow user use Undo option.
|
||||||
|
*/
|
||||||
|
bool openingPattern;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline MeasurementsType VAbstractApplication::patternType() const
|
||||||
|
{
|
||||||
|
return _patternType;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline void VAbstractApplication::setPatternType(const MeasurementsType &patternType)
|
||||||
|
{
|
||||||
|
_patternType = patternType;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
QString VAbstractApplication::LocaleToString(const T &value)
|
||||||
|
{
|
||||||
|
QLocale loc;
|
||||||
|
qApp->Settings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
|
||||||
|
return loc.toString(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline void VAbstractApplication::setCurrentDocument(VAbstractPattern *doc)
|
||||||
|
{
|
||||||
|
this->doc = doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline VAbstractPattern *VAbstractApplication::getCurrentDocument() const
|
||||||
|
{
|
||||||
|
SCASSERT(doc != nullptr)
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline bool VAbstractApplication::getOpeningPattern() const
|
||||||
|
{
|
||||||
|
return openingPattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline void VAbstractApplication::setOpeningPattern()
|
||||||
|
{
|
||||||
|
openingPattern = !openingPattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline QWidget *VAbstractApplication::getMainWindow() const
|
||||||
|
{
|
||||||
|
return mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline void VAbstractApplication::setMainWindow(QWidget *value)
|
||||||
|
{
|
||||||
|
SCASSERT(value != nullptr)
|
||||||
|
mainWindow = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline QUndoStack *VAbstractApplication::getUndoStack() const
|
||||||
|
{
|
||||||
|
return undoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VABSTRACTAPPLICATION_H
|
22
src/libs/vmisc/vmisc.pri
Normal file
22
src/libs/vmisc/vmisc.pri
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
|
||||||
|
# This need for corect working file translations.pro
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/stable.cpp \
|
||||||
|
$$PWD/def.cpp \
|
||||||
|
$$PWD/undoevent.cpp \
|
||||||
|
$$PWD/backport/qcommandlineoption.cpp \
|
||||||
|
$$PWD/backport/qcommandlineparser.cpp \
|
||||||
|
$$PWD/vsettings.cpp \
|
||||||
|
$$PWD/vabstractapplication.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/stable.h \
|
||||||
|
$$PWD/def.h \
|
||||||
|
$$PWD/logging.h \
|
||||||
|
$$PWD/vmath.h \
|
||||||
|
$$PWD/undoevent.h \
|
||||||
|
$$PWD/backport/qcommandlineoption.h \
|
||||||
|
$$PWD/backport/qcommandlineparser.h \
|
||||||
|
$$PWD/vsettings.h \
|
||||||
|
$$PWD/vabstractapplication.h
|
103
src/libs/vmisc/vmisc.pro
Normal file
103
src/libs/vmisc/vmisc.pro
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2015-06-15T14:07:14
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
# File with common stuff for whole project
|
||||||
|
include(../../../Valentina.pri)
|
||||||
|
|
||||||
|
QT += widgets
|
||||||
|
|
||||||
|
# Name of library
|
||||||
|
TARGET = vmisc
|
||||||
|
|
||||||
|
# We want to create a library
|
||||||
|
TEMPLATE = lib
|
||||||
|
|
||||||
|
CONFIG += \
|
||||||
|
staticlib \# Making static library
|
||||||
|
c++11 # We use C++11 standard
|
||||||
|
|
||||||
|
# Use out-of-source builds (shadow builds)
|
||||||
|
CONFIG -= debug_and_release debug_and_release_target
|
||||||
|
|
||||||
|
# Since Qt 5.4.0 the source code location is recorded only in debug builds.
|
||||||
|
# We need this information also in release builds. For this need define QT_MESSAGELOGCONTEXT.
|
||||||
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
|
include(vmisc.pri)
|
||||||
|
|
||||||
|
# This is static library so no need in "make install"
|
||||||
|
|
||||||
|
# directory for executable file
|
||||||
|
DESTDIR = bin
|
||||||
|
|
||||||
|
# files created moc
|
||||||
|
MOC_DIR = moc
|
||||||
|
|
||||||
|
# objecs files
|
||||||
|
OBJECTS_DIR = obj
|
||||||
|
|
||||||
|
# Set using ccache. Function enable_ccache() defined in Valentina.pri.
|
||||||
|
$$enable_ccache()
|
||||||
|
|
||||||
|
# Set precompiled headers. Function set_PCH() defined in Valentina.pri.
|
||||||
|
$$set_PCH()
|
||||||
|
|
||||||
|
CONFIG(debug, debug|release){
|
||||||
|
# Debug mode
|
||||||
|
unix {
|
||||||
|
#Turn on compilers warnings.
|
||||||
|
*-g++{
|
||||||
|
QMAKE_CXXFLAGS += \
|
||||||
|
# Key -isystem disable checking errors in system headers.
|
||||||
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
|
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
||||||
|
|
||||||
|
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
|
||||||
|
# do nothing
|
||||||
|
} else {
|
||||||
|
#gcc’s 4.8.0 Address Sanitizer
|
||||||
|
#http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
|
||||||
|
QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||||
|
QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||||
|
QMAKE_LFLAGS += -fsanitize=address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clang*{
|
||||||
|
QMAKE_CXXFLAGS += \
|
||||||
|
# Key -isystem disable checking errors in system headers.
|
||||||
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
|
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
||||||
|
|
||||||
|
# -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and
|
||||||
|
# want them in global list. Compromise decision delete them from local list.
|
||||||
|
QMAKE_CXXFLAGS -= \
|
||||||
|
-Wmissing-prototypes
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*-g++{
|
||||||
|
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
# Release mode
|
||||||
|
DEFINES += V_NO_ASSERT
|
||||||
|
!unix:*-g++{
|
||||||
|
QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll
|
||||||
|
}
|
||||||
|
|
||||||
|
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
|
||||||
|
# do nothing
|
||||||
|
} else {
|
||||||
|
!macx:!win32-msvc*{
|
||||||
|
# Turn on debug symbols in release mode on Unix systems.
|
||||||
|
# On Mac OS X temporarily disabled. TODO: find way how to strip binary file.
|
||||||
|
QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
|
||||||
|
QMAKE_CFLAGS_RELEASE += -g -gdwarf-3
|
||||||
|
QMAKE_LFLAGS_RELEASE =
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,10 +33,10 @@
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "../xml/vabstractmeasurements.h"
|
#include "../../libs/ifc/ifcdef.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
|
@ -25,7 +25,6 @@ CONFIG -= debug_and_release debug_and_release_target
|
||||||
DEFINES += QT_MESSAGELOGCONTEXT
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
include(vobj.pri)
|
include(vobj.pri)
|
||||||
include(../../utils/utils.pri)
|
|
||||||
|
|
||||||
# This is static library so no need in "make install"
|
# This is static library so no need in "make install"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../utils/vmath.h"
|
# include "../libs/vmisc/vmath.h"
|
||||||
#else
|
#else
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#define CALCULATOR_H
|
#define CALCULATOR_H
|
||||||
|
|
||||||
#include "../qmuparser/qmuparser.h"
|
#include "../qmuparser/qmuparser.h"
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QSharedDataPointer>
|
#include <QSharedDataPointer>
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
class VInternalVariableData;
|
class VInternalVariableData;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "vcontainer.h"
|
#include "vcontainer.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
#include "../vgeometry/vsplinepath.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
#include "../../utils/logging.h"
|
#include "../vmisc/logging.h"
|
||||||
#include "vtranslatevars.h"
|
#include "vtranslatevars.h"
|
||||||
|
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
|
@ -454,9 +454,9 @@ const QMap<QString, QSharedPointer<VArcAngle> > VContainer::DataAnglesArcs() con
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
const QMap<QString, QSharedPointer<VCurveAngle> > VContainer::DataAnglesCurves() const
|
const QMap<QString, QSharedPointer<VSplineAngle> > VContainer::DataAnglesCurves() const
|
||||||
{
|
{
|
||||||
return DataVar<VCurveAngle>(VarType::SplineAngle);
|
return DataVar<VSplineAngle>(VarType::SplineAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -156,7 +156,7 @@ public:
|
||||||
const QMap<QString, QSharedPointer<VLineAngle> > DataAngleLines() const;
|
const QMap<QString, QSharedPointer<VLineAngle> > DataAngleLines() const;
|
||||||
const QMap<QString, QSharedPointer<VArcRadius> > DataRadiusesArcs() const;
|
const QMap<QString, QSharedPointer<VArcRadius> > DataRadiusesArcs() const;
|
||||||
const QMap<QString, QSharedPointer<VArcAngle> > DataAnglesArcs() const;
|
const QMap<QString, QSharedPointer<VArcAngle> > DataAnglesArcs() const;
|
||||||
const QMap<QString, QSharedPointer<VCurveAngle> > DataAnglesCurves() const;
|
const QMap<QString, QSharedPointer<VSplineAngle> > DataAnglesCurves() const;
|
||||||
|
|
||||||
static bool IsUnique(const QString &name);
|
static bool IsUnique(const QString &name);
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vformula.h"
|
#include "vformula.h"
|
||||||
#include "../libs/vpatterndb/calculator.h"
|
#include "calculator.h"
|
||||||
#include "../libs/vpatterndb/vcontainer.h"
|
#include "vcontainer.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../core/vsettings.h"
|
#include "../vmisc/vsettings.h"
|
||||||
|
#include "vtranslatevars.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
//VFormula
|
//VFormula
|
||||||
|
@ -102,7 +103,7 @@ QString VFormula::GetFormula(FormulaType type) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
|
return qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +227,7 @@ void VFormula::Eval()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Calculator *cal = new Calculator(data, qApp->patternType());
|
Calculator *cal = new Calculator(data, qApp->patternType());
|
||||||
QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
|
QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal result = cal->EvalFormula(expression);
|
const qreal result = cal->EvalFormula(expression);
|
||||||
delete cal;
|
delete cal;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QSharedDataPointer>
|
#include <QSharedDataPointer>
|
||||||
|
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
class VNodeDetailData;
|
class VNodeDetailData;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ SOURCES += \
|
||||||
$$PWD/variables/vmeasurement.cpp \
|
$$PWD/variables/vmeasurement.cpp \
|
||||||
$$PWD/variables/vsplineangle.cpp \
|
$$PWD/variables/vsplineangle.cpp \
|
||||||
$$PWD/variables/vsplinelength.cpp \
|
$$PWD/variables/vsplinelength.cpp \
|
||||||
$$PWD/variables/vvariable.cpp
|
$$PWD/variables/vvariable.cpp \
|
||||||
|
$$PWD/vformula.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/vcontainer.h \
|
$$PWD/vcontainer.h \
|
||||||
|
@ -54,4 +55,5 @@ HEADERS += \
|
||||||
$$PWD/variables/vsplineangle.h \
|
$$PWD/variables/vsplineangle.h \
|
||||||
$$PWD/variables/vsplinelength.h \
|
$$PWD/variables/vsplinelength.h \
|
||||||
$$PWD/variables/vvariable.h \
|
$$PWD/variables/vvariable.h \
|
||||||
$$PWD/variables/vvariable_p.h
|
$$PWD/variables/vvariable_p.h \
|
||||||
|
$$PWD/vformula.h
|
||||||
|
|
|
@ -25,7 +25,6 @@ CONFIG -= debug_and_release debug_and_release_target
|
||||||
DEFINES += QT_MESSAGELOGCONTEXT
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
include(vpatterndb.pri)
|
include(vpatterndb.pri)
|
||||||
include(../../utils/utils.pri)
|
|
||||||
|
|
||||||
# This is static library so no need in "make install"
|
# This is static library so no need in "make install"
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "vtranslatevars.h"
|
#include "vtranslatevars.h"
|
||||||
#include "calculator.h"
|
#include "calculator.h"
|
||||||
#include "../../utils/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
|
||||||
using namespace qmu;
|
using namespace qmu;
|
||||||
|
|
98
src/libs/vtools/dialogs/dialogs.pri
Normal file
98
src/libs/vtools/dialogs/dialogs.pri
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
|
||||||
|
# This need for corect working file translations.pro
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/tooldialogs.h \
|
||||||
|
$$PWD/tools/dialogalongline.h \
|
||||||
|
$$PWD/tools/dialogarc.h \
|
||||||
|
$$PWD/tools/dialogarcwithlength.h \
|
||||||
|
$$PWD/tools/dialogbisector.h \
|
||||||
|
$$PWD/tools/dialogcurveintersectaxis.h \
|
||||||
|
$$PWD/tools/dialogcutarc.h \
|
||||||
|
$$PWD/tools/dialogcutspline.h \
|
||||||
|
$$PWD/tools/dialogcutsplinepath.h \
|
||||||
|
$$PWD/tools/dialogdetail.h \
|
||||||
|
$$PWD/tools/dialogendline.h \
|
||||||
|
$$PWD/tools/dialogheight.h \
|
||||||
|
$$PWD/tools/dialogline.h \
|
||||||
|
$$PWD/tools/dialoglineintersect.h \
|
||||||
|
$$PWD/tools/dialoglineintersectaxis.h \
|
||||||
|
$$PWD/tools/dialognormal.h \
|
||||||
|
$$PWD/tools/dialogpointfromarcandtangent.h \
|
||||||
|
$$PWD/tools/dialogpointfromcircleandtangent.h \
|
||||||
|
$$PWD/tools/dialogpointofcontact.h \
|
||||||
|
$$PWD/tools/dialogpointofintersection.h \
|
||||||
|
$$PWD/tools/dialogpointofintersectionarcs.h \
|
||||||
|
$$PWD/tools/dialogpointofintersectioncircles.h \
|
||||||
|
$$PWD/tools/dialogshoulderpoint.h \
|
||||||
|
$$PWD/tools/dialogsinglepoint.h \
|
||||||
|
$$PWD/tools/dialogspline.h \
|
||||||
|
$$PWD/tools/dialogsplinepath.h \
|
||||||
|
$$PWD/tools/dialogtool.h \
|
||||||
|
$$PWD/tools/dialogtriangle.h \
|
||||||
|
$$PWD/tools/dialoguniondetails.h \
|
||||||
|
$$PWD/support/dialogeditwrongformula.h \
|
||||||
|
$$PWD/support/dialogundo.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/tools/dialogalongline.cpp \
|
||||||
|
$$PWD/tools/dialogarc.cpp \
|
||||||
|
$$PWD/tools/dialogarcwithlength.cpp \
|
||||||
|
$$PWD/tools/dialogbisector.cpp \
|
||||||
|
$$PWD/tools/dialogcurveintersectaxis.cpp \
|
||||||
|
$$PWD/tools/dialogcutarc.cpp \
|
||||||
|
$$PWD/tools/dialogcutspline.cpp \
|
||||||
|
$$PWD/tools/dialogcutsplinepath.cpp \
|
||||||
|
$$PWD/tools/dialogdetail.cpp \
|
||||||
|
$$PWD/tools/dialogendline.cpp \
|
||||||
|
$$PWD/tools/dialogheight.cpp \
|
||||||
|
$$PWD/tools/dialogline.cpp \
|
||||||
|
$$PWD/tools/dialoglineintersect.cpp \
|
||||||
|
$$PWD/tools/dialoglineintersectaxis.cpp \
|
||||||
|
$$PWD/tools/dialognormal.cpp \
|
||||||
|
$$PWD/tools/dialogpointfromarcandtangent.cpp \
|
||||||
|
$$PWD/tools/dialogpointfromcircleandtangent.cpp \
|
||||||
|
$$PWD/tools/dialogpointofcontact.cpp \
|
||||||
|
$$PWD/tools/dialogpointofintersection.cpp \
|
||||||
|
$$PWD/tools/dialogpointofintersectionarcs.cpp \
|
||||||
|
$$PWD/tools/dialogpointofintersectioncircles.cpp \
|
||||||
|
$$PWD/tools/dialogshoulderpoint.cpp \
|
||||||
|
$$PWD/tools/dialogsinglepoint.cpp \
|
||||||
|
$$PWD/tools/dialogspline.cpp \
|
||||||
|
$$PWD/tools/dialogsplinepath.cpp \
|
||||||
|
$$PWD/tools/dialogtool.cpp \
|
||||||
|
$$PWD/tools/dialogtriangle.cpp \
|
||||||
|
$$PWD/tools/dialoguniondetails.cpp \
|
||||||
|
$$PWD/support/dialogeditwrongformula.cpp \
|
||||||
|
$$PWD/support/dialogundo.cpp
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
$$PWD/tools/dialogalongline.ui \
|
||||||
|
$$PWD/tools/dialogarc.ui \
|
||||||
|
$$PWD/tools/dialogarcwithlength.ui \
|
||||||
|
$$PWD/tools/dialogbisector.ui \
|
||||||
|
$$PWD/tools/dialogcurveintersectaxis.ui \
|
||||||
|
$$PWD/tools/dialogcutarc.ui \
|
||||||
|
$$PWD/tools/dialogcutspline.ui \
|
||||||
|
$$PWD/tools/dialogcutsplinepath.ui \
|
||||||
|
$$PWD/tools/dialogdetail.ui \
|
||||||
|
$$PWD/tools/dialogendline.ui \
|
||||||
|
$$PWD/tools/dialogheight.ui \
|
||||||
|
$$PWD/tools/dialogline.ui \
|
||||||
|
$$PWD/tools/dialoglineintersect.ui \
|
||||||
|
$$PWD/tools/dialoglineintersectaxis.ui \
|
||||||
|
$$PWD/tools/dialognormal.ui \
|
||||||
|
$$PWD/tools/dialogpointfromarcandtangent.ui \
|
||||||
|
$$PWD/tools/dialogpointfromcircleandtangent.ui \
|
||||||
|
$$PWD/tools/dialogpointofcontact.ui \
|
||||||
|
$$PWD/tools/dialogpointofintersection.ui \
|
||||||
|
$$PWD/tools/dialogpointofintersectionarcs.ui \
|
||||||
|
$$PWD/tools/dialogpointofintersectioncircles.ui \
|
||||||
|
$$PWD/tools/dialogshoulderpoint.ui \
|
||||||
|
$$PWD/tools/dialogsinglepoint.ui \
|
||||||
|
$$PWD/tools/dialogspline.ui \
|
||||||
|
$$PWD/tools/dialogsplinepath.ui \
|
||||||
|
$$PWD/tools/dialogtriangle.ui \
|
||||||
|
$$PWD/tools/dialoguniondetails.ui \
|
||||||
|
$$PWD/support/dialogeditwrongformula.ui \
|
||||||
|
$$PWD/support/dialogundo.ui
|
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
#include "dialogeditwrongformula.h"
|
#include "dialogeditwrongformula.h"
|
||||||
#include "ui_dialogeditwrongformula.h"
|
#include "ui_dialogeditwrongformula.h"
|
||||||
#include "../../libs/vpatterndb/vcontainer.h"
|
#include "../../../vpatterndb/vcontainer.h"
|
||||||
|
#include "../../../vpatterndb/vtranslatevars.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
|
@ -203,8 +204,8 @@ void DialogEditWrongFormula::ValChenged(int row)
|
||||||
if (ui->radioButtonAnglesCurves->isChecked())
|
if (ui->radioButtonAnglesCurves->isChecked())
|
||||||
{
|
{
|
||||||
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||||
.arg(*data->GetVariable<VCurveAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
.arg(*data->GetVariable<VSplineAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
||||||
.arg(tr("Curve angle"));
|
.arg(tr("Curve angle"));
|
||||||
ui->labelDescription->setText(desc);
|
ui->labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +386,7 @@ void DialogEditWrongFormula::setPostfix(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogEditWrongFormula::GetFormula() const
|
QString DialogEditWrongFormula::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
|
return qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef DIALOGEDITWRONGFORMULA_H
|
#ifndef DIALOGEDITWRONGFORMULA_H
|
||||||
#define DIALOGEDITWRONGFORMULA_H
|
#define DIALOGEDITWRONGFORMULA_H
|
||||||
|
|
||||||
#include "dialogtool.h"
|
#include "../tools/dialogtool.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
#include "dialogundo.h"
|
#include "dialogundo.h"
|
||||||
#include "ui_dialogundo.h"
|
#include "ui_dialogundo.h"
|
||||||
#include "../../core/vapplication.h"
|
#include "../../../ifc/exception/vexceptionundo.h"
|
||||||
#include "../../libs/ifc/exception/vexceptionundo.h"
|
#include "../../../vmisc/vabstractapplication.h"
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ DialogUndo::DialogUndo(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
bool opening = qApp->getOpeningPattern();
|
bool opening = qApp->getOpeningPattern();
|
||||||
if (opening)
|
if (opening)
|
|
@ -29,7 +29,7 @@
|
||||||
<string>Broken formula</string>
|
<string>Broken formula</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
<iconset resource="../../../../app/share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../share/resources/icon.qrc"/>
|
<include location="../../../../app/share/resources/icon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
63
src/libs/vtools/dialogs/tooldialogs.h
Normal file
63
src/libs/vtools/dialogs/tooldialogs.h
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogs.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 16 6, 2015
|
||||||
|
**
|
||||||
|
** @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) 2015 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 TOOLDIALOGS_H
|
||||||
|
#define TOOLDIALOGS_H
|
||||||
|
|
||||||
|
#include "dialogs/tools/dialogalongline.h"
|
||||||
|
#include "dialogs/tools/dialogarc.h"
|
||||||
|
#include "dialogs/tools/dialogarcwithlength.h"
|
||||||
|
#include "dialogs/tools/dialogbisector.h"
|
||||||
|
#include "dialogs/tools/dialogdetail.h"
|
||||||
|
#include "dialogs/tools/dialogendline.h"
|
||||||
|
#include "dialogs/tools/dialogline.h"
|
||||||
|
#include "dialogs/tools/dialoglineintersect.h"
|
||||||
|
#include "dialogs/tools/dialognormal.h"
|
||||||
|
#include "dialogs/tools/dialogpointofcontact.h"
|
||||||
|
#include "dialogs/tools/dialogshoulderpoint.h"
|
||||||
|
#include "dialogs/tools/dialogsinglepoint.h"
|
||||||
|
#include "dialogs/tools/dialogspline.h"
|
||||||
|
#include "dialogs/tools/dialogsplinepath.h"
|
||||||
|
#include "dialogs/tools/dialogheight.h"
|
||||||
|
#include "dialogs/tools/dialogcutarc.h"
|
||||||
|
#include "dialogs/tools/dialogcutspline.h"
|
||||||
|
#include "dialogs/tools/dialogcutsplinepath.h"
|
||||||
|
#include "dialogs/tools/dialoguniondetails.h"
|
||||||
|
#include "dialogs/tools/dialogtriangle.h"
|
||||||
|
#include "dialogs/tools/dialogpointofintersection.h"
|
||||||
|
#include "dialogs/tools/dialoglineintersectaxis.h"
|
||||||
|
#include "dialogs/tools/dialogcurveintersectaxis.h"
|
||||||
|
#include "dialogs/tools/dialogpointofintersectionarcs.h"
|
||||||
|
#include "dialogs/tools/dialogpointofintersectioncircles.h"
|
||||||
|
#include "dialogs/tools/dialogpointfromcircleandtangent.h"
|
||||||
|
#include "dialogs/tools/dialogpointfromarcandtangent.h"
|
||||||
|
|
||||||
|
#include "dialogs/support/dialogeditwrongformula.h"
|
||||||
|
#include "dialogs/support/dialogundo.h"
|
||||||
|
|
||||||
|
#endif // TOOLDIALOGS_H
|
|
@ -30,8 +30,9 @@
|
||||||
#include "ui_dialogalongline.h"
|
#include "ui_dialogalongline.h"
|
||||||
#include "../../visualization/vistoolalongline.h"
|
#include "../../visualization/vistoolalongline.h"
|
||||||
#include "../../tools/vabstracttool.h"
|
#include "../../tools/vabstracttool.h"
|
||||||
#include "../../widgets/vmaingraphicsscene.h"
|
#include "../../../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "dialogeditwrongformula.h"
|
#include "../../../vpatterndb/vtranslatevars.h"
|
||||||
|
#include "../support/dialogeditwrongformula.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
@ -306,7 +307,7 @@ QString DialogAlongLine::GetTypeLine() const
|
||||||
*/
|
*/
|
||||||
QString DialogAlongLine::GetFormula() const
|
QString DialogAlongLine::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
|
return qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
|
@ -26,7 +26,7 @@
|
||||||
<string>Point at distance along line</string>
|
<string>Point at distance along line</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
<iconset resource="../../../../app/share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
<string notr="true">...</string>
|
<string notr="true">...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
<iconset resource="../../../../app/share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap resource="../../share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
<pixmap resource="../../../../app/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -332,7 +332,7 @@
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../share/resources/icon.qrc"/>
|
<include location="../../../../app/share/resources/icon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
|
@ -32,11 +32,12 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "../../libs/vgeometry/vpointf.h"
|
#include "../../../vgeometry/vpointf.h"
|
||||||
#include "../../libs/vpatterndb/vcontainer.h"
|
#include "../../../vpatterndb/vcontainer.h"
|
||||||
#include "../../libs/ifc/xml/vdomdocument.h"
|
#include "../../../vpatterndb/vtranslatevars.h"
|
||||||
|
#include "../../../ifc/xml/vdomdocument.h"
|
||||||
#include "../../visualization/vistoolarc.h"
|
#include "../../visualization/vistoolarc.h"
|
||||||
#include "dialogeditwrongformula.h"
|
#include "../support/dialogeditwrongformula.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -424,7 +425,7 @@ quint32 DialogArc::GetCenter() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetRadius() const
|
QString DialogArc::GetRadius() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaFromUser(radius, qApp->getSettings()->GetOsSeparator());
|
return qApp->TrVars()->FormulaFromUser(radius, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -434,7 +435,7 @@ QString DialogArc::GetRadius() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetF1() const
|
QString DialogArc::GetF1() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaFromUser(f1, qApp->getSettings()->GetOsSeparator());
|
return qApp->TrVars()->FormulaFromUser(f1, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -444,5 +445,5 @@ QString DialogArc::GetF1() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetF2() const
|
QString DialogArc::GetF2() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaFromUser(f2, qApp->getSettings()->GetOsSeparator());
|
return qApp->TrVars()->FormulaFromUser(f2, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user