Merge with feature

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-06-12 13:37:55 +03:00
commit da1ec57ce6
169 changed files with 3006 additions and 2611 deletions

View File

@ -14,7 +14,8 @@ DEPENDPATH += \
../src/libs/ifc \
../src/libs/vobj \
../src/libs/vlayout \
../src/libs/vgeometry
../src/libs/vgeometry \
../src/libs/vpatterndb
include(../src/app/app.pri)
include(../src/libs/qmuparser/qmuparser.pri)
@ -23,6 +24,7 @@ include(../src/libs/ifc/ifc.pri)
include(../src/libs/vobj/vobj.pri)
include(../src/libs/vlayout/vlayout.pri)
include(../src/libs/vgeometry/vgeometry.pri)
include(../src/libs/vpatterndb/vpatterndb.pri)
# 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).

View File

@ -1,7 +1,5 @@
# Suport subdirectories. Just better project code tree.
include(container/container.pri)
include(dialogs/dialogs.pri)
include(geometry/geometry.pri)
include(tools/tools.pri)
include(widgets/widgets.pri)
include(xml/xml.pri)

View File

@ -600,6 +600,15 @@ 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
#VPatternDB staic library
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
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing
} else {

View File

@ -6,11 +6,13 @@ HEADERS += \
$$PWD/undoevent.h \
$$PWD/vsettings.h \
$$PWD/backport/qcommandlineoption.h \
$$PWD/backport/qcommandlineparser.h
$$PWD/backport/qcommandlineparser.h \
$$PWD/vformula.h
SOURCES += \
$$PWD/vapplication.cpp \
$$PWD/undoevent.cpp \
$$PWD/vsettings.cpp \
$$PWD/backport/qcommandlineoption.cpp \
$$PWD/backport/qcommandlineparser.cpp
$$PWD/backport/qcommandlineparser.cpp \
$$PWD/vformula.cpp

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@
#include <QApplication>
#include "../options.h"
#include "../widgets/vmaingraphicsview.h"
#include "../../libs/qmuparser/qmutranslation.h"
#include "../libs/vpatterndb/vtranslatevars.h"
#include "vsettings.h"
class VApplication;// used in define
@ -62,31 +62,23 @@ public:
static void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
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);
double toPixel(double val, const Unit &unit) const;
void InitOptions();
double toPixel(double val) const;
double fromPixel(double pix, const Unit &unit) const;
double fromPixel(double pix) const;
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
static bool TryLock(QLockFile *lock);
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
static const qreal PrintDPI;
QString translationsPath() const;
qreal widthMainLine() const;
qreal widthHairLine() const;
QString VarToUser(const QString &var) const;
QString VarFromUser(const QString &var) const;
QString GuiText(const QString &measurement) const;
QString Description(const QString &measurement) const;
QString PostfixOperator(const QString &name) const;
QString FormulaFromUser(const QString &formula);
QString FormulaToUser(const QString &formula);
template <typename T>
QString LocaleToString(const T &value)
@ -119,11 +111,13 @@ public:
static void restoreOverrideCursor(const QString & pixmapPath);
static QStringList LabelLanguages();
QString STDescription(const QString &id)const;
void StartLogging();
QTextStream *LogFile();
const VTranslateVars *TrVars();
void InitTrVars();
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
static void DrMingw();
@ -141,13 +135,7 @@ private:
MeasurementsType _patternType;
qreal _widthMainLine;
qreal _widthHairLine;
QMap<QString, qmu::QmuTranslation> measurements;
QMap<QString, qmu::QmuTranslation> guiTexts;
QMap<QString, qmu::QmuTranslation> descriptions;
QMap<QString, qmu::QmuTranslation> variables;
QMap<QString, qmu::QmuTranslation> functions;
QMap<QString, qmu::QmuTranslation> postfixOperators;
QMap<QString, qmu::QmuTranslation> stDescriptions;
VTranslateVars *trVars;
QUndoStack *undoStack;
VMainGraphicsView *sceneView;
QGraphicsScene *currentScene;
@ -174,22 +162,6 @@ private:
QLockFile *logLock;
#endif
void InitLineWidth();
void InitMeasurements();
void InitVariables();
void InitFunctions();
void InitPostfixOperators();
void InitSTDescriptions();
bool MeasurementsFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
bool VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
bool PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token,
int &bias) const;
bool FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
bool VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const;
void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
QMap<int, QString> &numbers);
void BiasTokens(int position, int bias, QMap<int, QString> &tokens) const;
void InitMeasurement(const QString &name, const qmu::QmuTranslation &m, const qmu::QmuTranslation &g,
const qmu::QmuTranslation &d);
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
static const QString GistFileName;
@ -214,6 +186,12 @@ inline Unit VApplication::patternUnit() const
return _patternUnit;
}
//---------------------------------------------------------------------------------------------------------------------
inline const Unit *VApplication::patternUnitP() const
{
return &_patternUnit;
}
//---------------------------------------------------------------------------------------------------------------------
inline MeasurementsType VApplication::patternType() const
{

View File

@ -27,8 +27,8 @@
*************************************************************************/
#include "vformula.h"
#include "../container/calculator.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/calculator.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../core/vapplication.h"
#include "../core/vsettings.h"
#include <QDebug>
@ -42,7 +42,7 @@ VFormula::VFormula()
//---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula(const QString &formula, const VContainer *container)
:formula(qApp->FormulaToUser(formula)), value(QString(tr("Error"))), checkZero(true), data(container),
:formula(qApp->TrVars()->FormulaToUser(formula)), value(QString(tr("Error"))), checkZero(true), data(container),
toolId(NULL_ID), postfix(QString()), _error(true), dValue(0)
{
this->formula.replace("\n", " ");// Replace line return with spaces for calc if exist
@ -102,7 +102,7 @@ QString VFormula::GetFormula(FormulaType type) const
}
else
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
}
@ -113,7 +113,7 @@ void VFormula::SetFormula(const QString &value, FormulaType type)
{
if (type == FormulaType::ToUser)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
}
else
{
@ -225,8 +225,8 @@ void VFormula::Eval()
{
try
{
Calculator *cal = new Calculator(data);
QString expression = qApp->FormulaFromUser(formula);
Calculator *cal = new Calculator(data, qApp->patternType());
QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
const qreal result = cal->EvalFormula(expression);
delete cal;

View File

@ -492,7 +492,7 @@ void VSettings::SetUserPassword(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
int VSettings::GetLayoutPaperHeight() const
{
const int def = qFloor(VAbstractMeasurements::UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px));
const int def = qFloor(UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px));
bool ok = false;
const int height = value(SettingLayoutPaperHeight, def).toInt(&ok);
if (ok)
@ -514,7 +514,7 @@ void VSettings::SetLayoutPaperHeight(int value)
//---------------------------------------------------------------------------------------------------------------------
int VSettings::GetLayoutPaperWidth() const
{
const int def = qFloor(VAbstractMeasurements::UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px));
const int def = qFloor(UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px));
bool ok = false;
const int width = value(SettingLayoutPaperWidth, def).toInt(&ok);
if (ok)
@ -552,7 +552,7 @@ unsigned int VSettings::GetLayoutShift() const
//---------------------------------------------------------------------------------------------------------------------
unsigned int VSettings::GetDefLayoutShift()
{
return static_cast<unsigned int>(VAbstractMeasurements::UnitConvertor(50, Unit::Mm, Unit::Px));
return static_cast<unsigned int>(UnitConvertor(50, Unit::Mm, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
@ -580,7 +580,7 @@ unsigned int VSettings::GetLayoutWidth() const
//---------------------------------------------------------------------------------------------------------------------
unsigned int VSettings::GetDefLayoutWidth()
{
return static_cast<unsigned int>(VAbstractMeasurements::UnitConvertor(2.5, Unit::Mm, Unit::Px));
return static_cast<unsigned int>(UnitConvertor(2.5, Unit::Mm, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -214,7 +214,8 @@ void DialogIncrements::FillMeasurements()
if (qApp->patternType() == MeasurementsType::Standard)
{
QTableWidgetItem *item = new QTableWidgetItem(qApp->LocaleToString(
data->GetTableValue(qApp->VarFromUser(iMap.key()))));
data->GetTableValue(qApp->TrVars()->VarFromUser(iMap.key()),
qApp->patternType())));
item->setTextAlignment(Qt::AlignHCenter);
SetItemViewOnly(item);
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);// calculated value
@ -286,7 +287,7 @@ void DialogIncrements::FillIncrements()
if (qApp->patternType() == MeasurementsType::Standard)
{
item = new QTableWidgetItem(qApp->LocaleToString(data->GetTableValue(iMap.value())));
item = new QTableWidgetItem(qApp->LocaleToString(data->GetTableValue(iMap.value(), qApp->patternType())));
item->setTextAlignment(Qt::AlignHCenter);
SetItemViewOnly(item);
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
@ -915,7 +916,8 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);// name column
QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
QSharedPointer<VMeasurement> measur = data->GetVariable<VMeasurement>(qApp->VarFromUser(itemName->text()));
QSharedPointer<VMeasurement> measur = data->GetVariable<VMeasurement>(
qApp->TrVars()->VarFromUser(itemName->text()));
const QString tag = measur->TagName();
QDomNodeList list = m->elementsByTagName(tag);
QDomElement domElement = list.at(0).toElement();
@ -940,7 +942,7 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
qCDebug(vDialog, "Changed value to %f", base);
// Convert value to measurements table unit
base = VAbstractMeasurements::UnitConvertor(base, qApp->patternUnit(), m->MUnit());
base = UnitConvertor(base, qApp->patternUnit(), m->MUnit());
m->SetAttribute(domElement, VIndividualMeasurements::AttrValue, QString("%1").arg(base));
QString error;

View File

@ -31,7 +31,7 @@
#include "../../xml/vindividualmeasurements.h"
#include "../../core/vapplication.h"
#include "../../core/vsettings.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include <QFileDialog>
#include <QMessageBox>

View File

@ -31,7 +31,6 @@
#include "../../core/vapplication.h"
#include "../../libs/ifc/xml/vdomdocument.h"
#include "../../core/vsettings.h"
#include "../../xml/vabstractmeasurements.h"
#include "../../libs/vlayout/vlayoutgenerator.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
@ -86,51 +85,51 @@ DialogLayoutSettings::~DialogLayoutSettings()
//---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::GetPaperHeight() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), oldPaperUnit, Unit::Px));
return qFloor(UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), oldPaperUnit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetPaperHeight(int value)
{
ui->doubleSpinBoxPaperHeight->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, PaperUnit()));
ui->doubleSpinBoxPaperHeight->setValue(UnitConvertor(value, Unit::Px, PaperUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::GetPaperWidth() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), oldPaperUnit, Unit::Px));
return qFloor(UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), oldPaperUnit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetPaperWidth(int value)
{
ui->doubleSpinBoxPaperWidth->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, PaperUnit()));
ui->doubleSpinBoxPaperWidth->setValue(UnitConvertor(value, Unit::Px, PaperUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetShift() const
{
return static_cast<quint32>(qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxShift->value(),
return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxShift->value(),
oldLayoutUnit, Unit::Px)));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetShift(unsigned int value)
{
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, LayoutUnit()));
ui->doubleSpinBoxShift->setValue(UnitConvertor(value, Unit::Px, LayoutUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetLayoutWidth() const
{
return static_cast<quint32>(qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(),
return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(),
oldLayoutUnit, Unit::Px)));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetLayoutWidth(unsigned int value)
{
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, LayoutUnit()));
ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(value, Unit::Px, LayoutUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
@ -254,11 +253,11 @@ void DialogLayoutSettings::ConvertPaperSize()
const qreal width = ui->doubleSpinBoxPaperWidth->value();
const qreal height = ui->doubleSpinBoxPaperHeight->value();
ui->doubleSpinBoxPaperWidth->setMaximum(qApp->fromPixel(QIMAGE_MAX, paperUnit));
ui->doubleSpinBoxPaperHeight->setMaximum(qApp->fromPixel(QIMAGE_MAX, paperUnit));
ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, paperUnit));
ui->doubleSpinBoxPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, paperUnit));
ui->doubleSpinBoxPaperWidth->setValue(VAbstractMeasurements::UnitConvertor(width, oldPaperUnit, paperUnit));
ui->doubleSpinBoxPaperHeight->setValue(VAbstractMeasurements::UnitConvertor(height, oldPaperUnit, paperUnit));
ui->doubleSpinBoxPaperWidth->setValue(UnitConvertor(width, oldPaperUnit, paperUnit));
ui->doubleSpinBoxPaperHeight->setValue(UnitConvertor(height, oldPaperUnit, paperUnit));
oldPaperUnit = paperUnit;
CorrectPaperDecimals();
MinimumPaperSize();
@ -271,11 +270,11 @@ void DialogLayoutSettings::ConvertLayoutSize()
const qreal layoutWidth = ui->doubleSpinBoxLayoutWidth->value();
const qreal shift = ui->doubleSpinBoxShift->value();
ui->doubleSpinBoxLayoutWidth->setMaximum(qApp->fromPixel(QIMAGE_MAX, unit));
ui->doubleSpinBoxShift->setMaximum(qApp->fromPixel(QIMAGE_MAX, unit));
ui->doubleSpinBoxLayoutWidth->setMaximum(FromPixel(QIMAGE_MAX, unit));
ui->doubleSpinBoxShift->setMaximum(FromPixel(QIMAGE_MAX, unit));
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(layoutWidth, oldLayoutUnit, unit));
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(shift, oldLayoutUnit, unit));
ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(layoutWidth, oldLayoutUnit, unit));
ui->doubleSpinBoxShift->setValue(UnitConvertor(shift, oldLayoutUnit, unit));
oldLayoutUnit = unit;
CorrectLayoutDecimals();
MinimumLayoutSize();
@ -389,7 +388,7 @@ void DialogLayoutSettings::InitTemplates()
{
const QIcon icoPaper("://icon/16x16/template.png");
const QIcon icoRoll("://icon/16x16/roll.png");
const QString pdi = QString("(%1ppi)").arg(VApplication::PrintDPI);
const QString pdi = QString("(%1ppi)").arg(PrintDPI);
ui->comboBoxTemplates->addItem(icoPaper, "A0 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A0)));
ui->comboBoxTemplates->addItem(icoPaper, "A1 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A1)));
@ -432,74 +431,74 @@ QSizeF DialogLayoutSettings::Template()
case PaperSizeTemplate::A0:
SetAdditionalOptions(false);
width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(1189, Unit::Mm, paperUnit);
width = UnitConvertor(841, Unit::Mm, paperUnit);
height = UnitConvertor(1189, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A1:
SetAdditionalOptions(false);
width = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
width = UnitConvertor(594, Unit::Mm, paperUnit);
height = UnitConvertor(841, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A2:
SetAdditionalOptions(false);
width = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
width = UnitConvertor(420, Unit::Mm, paperUnit);
height = UnitConvertor(594, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A3:
SetAdditionalOptions(false);
width = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
width = UnitConvertor(297, Unit::Mm, paperUnit);
height = UnitConvertor(420, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A4:
SetAdditionalOptions(false);
width = VAbstractMeasurements::UnitConvertor(210, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
width = UnitConvertor(210, Unit::Mm, paperUnit);
height = UnitConvertor(297, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Letter:
SetAdditionalOptions(false);
width = VAbstractMeasurements::UnitConvertor(8.5, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(11, Unit::Inch, paperUnit);
width = UnitConvertor(8.5, Unit::Inch, paperUnit);
height = UnitConvertor(11, Unit::Inch, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Legal:
SetAdditionalOptions(true);
width = VAbstractMeasurements::UnitConvertor(11, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(17, Unit::Inch, paperUnit);
width = UnitConvertor(11, Unit::Inch, paperUnit);
height = UnitConvertor(17, Unit::Inch, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Roll24in:
SetAdditionalOptions(true);
width = VAbstractMeasurements::UnitConvertor(24, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
width = UnitConvertor(24, Unit::Inch, paperUnit);
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Roll30in:
SetAdditionalOptions(true);
width = VAbstractMeasurements::UnitConvertor(30, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
width = UnitConvertor(30, Unit::Inch, paperUnit);
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Roll36in:
SetAdditionalOptions(true);
width = VAbstractMeasurements::UnitConvertor(36, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
width = UnitConvertor(36, Unit::Inch, paperUnit);
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Roll42in:
SetAdditionalOptions(true);
width = VAbstractMeasurements::UnitConvertor(42, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
width = UnitConvertor(42, Unit::Inch, paperUnit);
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::Roll44in:
SetAdditionalOptions(true);
width = VAbstractMeasurements::UnitConvertor(44, Unit::Inch, paperUnit);
height = VAbstractMeasurements::UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
width = UnitConvertor(44, Unit::Inch, paperUnit);
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
return QSizeF(width, height);
default:
break;
@ -578,18 +577,16 @@ void DialogLayoutSettings::CorrectLayoutDecimals()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::Label()
{
const int width = qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), PaperUnit(),
Unit::Px));
const int height = qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperHeight->value(),
PaperUnit(), Unit::Px));
QString text = QString("%1 x %2 px, \n%3 ppi").arg(width).arg(height).arg(VApplication::PrintDPI);
const int width = qFloor(UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), PaperUnit(), Unit::Px));
const int height = qFloor(UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), PaperUnit(), Unit::Px));
QString text = QString("%1 x %2 px, \n%3 ppi").arg(width).arg(height).arg(PrintDPI);
ui->labelSizeDescription->setText(text);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::MinimumPaperSize()
{
const qreal value = VAbstractMeasurements::UnitConvertor(1, Unit::Px, oldPaperUnit);
const qreal value = UnitConvertor(1, Unit::Px, oldPaperUnit);
ui->doubleSpinBoxPaperWidth->setMinimum(value);
ui->doubleSpinBoxPaperHeight->setMinimum(value);
}
@ -597,7 +594,7 @@ void DialogLayoutSettings::MinimumPaperSize()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::MinimumLayoutSize()
{
const qreal value = VAbstractMeasurements::UnitConvertor(1, Unit::Px, oldLayoutUnit);
const qreal value = UnitConvertor(1, Unit::Px, oldLayoutUnit);
ui->doubleSpinBoxLayoutWidth->setMinimum(value);
}
@ -613,10 +610,8 @@ void DialogLayoutSettings::ReadSettings()
SetLayoutWidth(qApp->getSettings()->GetLayoutWidth());
SetShift(qApp->getSettings()->GetLayoutShift());
const qreal width = VAbstractMeasurements::UnitConvertor(qApp->getSettings()->GetLayoutPaperWidth(), Unit::Px,
LayoutUnit());
const qreal height = VAbstractMeasurements::UnitConvertor(qApp->getSettings()->GetLayoutPaperHeight(), Unit::Px,
LayoutUnit());
const qreal width = UnitConvertor(qApp->getSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
const qreal height = UnitConvertor(qApp->getSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
SheetSize(QSizeF(width, height));
SetGroup(qApp->getSettings()->GetLayoutGroup());
SetRotate(qApp->getSettings()->GetLayoutRotate());
@ -645,8 +640,8 @@ void DialogLayoutSettings::WriteSettings() const
void DialogLayoutSettings::SheetSize(const QSizeF &size)
{
oldPaperUnit = PaperUnit();
ui->doubleSpinBoxPaperWidth->setMaximum(qApp->fromPixel(QIMAGE_MAX, oldPaperUnit));
ui->doubleSpinBoxPaperHeight->setMaximum(qApp->fromPixel(QIMAGE_MAX, oldPaperUnit));
ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, oldPaperUnit));
ui->doubleSpinBoxPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, oldPaperUnit));
ui->doubleSpinBoxPaperWidth->setValue(size.width());
ui->doubleSpinBoxPaperHeight->setValue(size.height());

View File

@ -31,7 +31,7 @@
#include "../../xml/vstandardmeasurements.h"
#include "../../core/vapplication.h"
#include "../../core/vsettings.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../utils/logging.h"
#include <QDir>

View File

@ -240,7 +240,7 @@ void DialogAlongLine::SetFirstPointId(const quint32 &value)
*/
void DialogAlongLine::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{
@ -306,7 +306,7 @@ QString DialogAlongLine::GetTypeLine() const
*/
QString DialogAlongLine::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -33,7 +33,7 @@
#include <QTimer>
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../libs/ifc/xml/vdomdocument.h"
#include "../../visualization/vistoolarc.h"
#include "dialogeditwrongformula.h"
@ -134,7 +134,7 @@ void DialogArc::SetCenter(const quint32 &value)
*/
void DialogArc::SetF2(const QString &value)
{
f2 = qApp->FormulaToUser(value);
f2 = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (f2.length() > 80)
{
@ -168,7 +168,7 @@ void DialogArc::SetColor(const QString &value)
*/
void DialogArc::SetF1(const QString &value)
{
f1 = qApp->FormulaToUser(value);
f1 = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (f1.length() > 80)
{
@ -190,7 +190,7 @@ void DialogArc::SetF1(const QString &value)
*/
void DialogArc::SetRadius(const QString &value)
{
radius = qApp->FormulaToUser(value);
radius = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (radius.length() > 80)
{
@ -424,7 +424,7 @@ quint32 DialogArc::GetCenter() const
*/
QString DialogArc::GetRadius() const
{
return qApp->FormulaFromUser(radius);
return qApp->TrVars()->FormulaFromUser(radius, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@ -434,7 +434,7 @@ QString DialogArc::GetRadius() const
*/
QString DialogArc::GetF1() const
{
return qApp->FormulaFromUser(f1);
return qApp->TrVars()->FormulaFromUser(f1, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@ -444,5 +444,5 @@ QString DialogArc::GetF1() const
*/
QString DialogArc::GetF2() const
{
return qApp->FormulaFromUser(f2);
return qApp->TrVars()->FormulaFromUser(f2, qApp->getSettings()->GetOsSeparator());
}

View File

@ -33,7 +33,7 @@
#include <QTimer>
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../libs/ifc/xml/vdomdocument.h"
#include "../../visualization/vistoolarcwithlength.h"
#include "dialogeditwrongformula.h"
@ -109,13 +109,13 @@ void DialogArcWithLength::SetCenter(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetRadius() const
{
return qApp->FormulaFromUser(radius);
return qApp->TrVars()->FormulaFromUser(radius, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::SetRadius(const QString &value)
{
radius = qApp->FormulaToUser(value);
radius = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (radius.length() > 80)
{
@ -133,12 +133,12 @@ void DialogArcWithLength::SetRadius(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetF1() const
{
return qApp->FormulaFromUser(f1);
return qApp->TrVars()->FormulaFromUser(f1, qApp->getSettings()->GetOsSeparator());
}
void DialogArcWithLength::SetF1(const QString &value)
{
f1 = qApp->FormulaToUser(value);
f1 = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (f1.length() > 80)
{
@ -156,13 +156,13 @@ void DialogArcWithLength::SetF1(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetLength() const
{
return qApp->FormulaFromUser(length);
return qApp->TrVars()->FormulaFromUser(length, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::SetLength(const QString &value)
{
length = qApp->FormulaToUser(value);
length = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (length.length() > 80)
{

View File

@ -30,7 +30,7 @@
#include "ui_dialogbisector.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolbisector.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h"
@ -230,7 +230,7 @@ void DialogBisector::SetTypeLine(const QString &value)
*/
void DialogBisector::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{
@ -342,7 +342,7 @@ QString DialogBisector::GetTypeLine() const
*/
QString DialogBisector::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogcurveintersectaxis.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolcurveintersectaxis.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h"
@ -99,13 +99,13 @@ void DialogCurveIntersectAxis::SetTypeLine(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogCurveIntersectAxis::GetAngle() const
{
return qApp->FormulaFromUser(formulaAngle);
return qApp->TrVars()->FormulaFromUser(formulaAngle, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::SetAngle(const QString &value)
{
formulaAngle = qApp->FormulaToUser(value);
formulaAngle = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaAngle.length() > 80)
@ -179,7 +179,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
qreal radius = qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
if (line.length() <= radius)
{
return;

View File

@ -30,7 +30,7 @@
#include "ui_dialogcutarc.h"
#include "../../libs/vgeometry/varc.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolcutarc.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../xml/vpattern.h"
@ -183,7 +183,7 @@ void DialogCutArc::SetColor(const QString &value)
*/
void DialogCutArc::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{
@ -216,7 +216,7 @@ void DialogCutArc::SetPointName(const QString &value)
*/
QString DialogCutArc::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogcutspline.h"
#include "../../libs/vgeometry/vspline.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../xml/vpattern.h"
#include "../../visualization/vistoolcutspline.h"
#include "dialogeditwrongformula.h"
@ -91,7 +91,7 @@ void DialogCutSpline::SetPointName(const QString &value)
*/
void DialogCutSpline::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
@ -210,7 +210,7 @@ void DialogCutSpline::ShowVisualization()
*/
QString DialogCutSpline::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogcutsplinepath.h"
#include "../../libs/vgeometry/vsplinepath.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../xml/vpattern.h"
#include "../../visualization/vistoolcutsplinepath.h"
#include "dialogeditwrongformula.h"
@ -91,7 +91,7 @@ void DialogCutSplinePath::SetPointName(const QString &value)
*/
void DialogCutSplinePath::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
@ -210,7 +210,7 @@ void DialogCutSplinePath::ShowVisualization()
*/
QString DialogCutSplinePath::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -33,7 +33,7 @@
#include "../../libs/vgeometry/varc.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../libs/vgeometry/vsplinepath.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../libs/ifc/xml/vdomdocument.h"
#include "../../xml/vabstractmeasurements.h"
@ -53,7 +53,7 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
ui.labelUnitY->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
// Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough.
ui.doubleSpinBoxSeams->setValue(VAbstractMeasurements::UnitConvertor(1, Unit::Cm, qApp->patternUnit()));
ui.doubleSpinBoxSeams->setValue(UnitConvertor(1, Unit::Cm, qApp->patternUnit()));
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr);

View File

@ -31,7 +31,7 @@
#include "ui_dialogdetail.h"
#include "dialogtool.h"
#include "../../geometry/vdetail.h"
#include "../../libs/vpatterndb/vdetail.h"
/**
* @brief The DialogDetail class dialog for ToolDetai. Help create detail and edit option.

View File

@ -28,7 +28,7 @@
#include "dialogeditwrongformula.h"
#include "ui_dialogeditwrongformula.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent)
@ -135,9 +135,10 @@ void DialogEditWrongFormula::ValChenged(int row)
}
if (ui->radioButtonStandardTable->isChecked())
{
const QString name = qApp->VarFromUser(item->text());
const QString name = qApp->TrVars()->VarFromUser(item->text());
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
const QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(name))
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(data->GetTableValue(name, qApp->patternType()))
.arg(stable->GetGuiText());
ui->labelDescription->setText(desc);
return;
@ -145,7 +146,8 @@ void DialogEditWrongFormula::ValChenged(int row)
if (ui->radioButtonIncrements->isChecked())
{
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(item->text());
const QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(item->text()))
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(data->GetTableValue(item->text(), qApp->patternType()))
.arg(incr->GetDescription());
ui->labelDescription->setText(desc);
return;
@ -153,56 +155,56 @@ void DialogEditWrongFormula::ValChenged(int row)
if (ui->radioButtonLengthLine->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VLengthLine>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Line length"));
.arg(*data->GetVariable<VLengthLine>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Line length"));
ui->labelDescription->setText(desc);
return;
}
if (ui->radioButtonLengthArc->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VArcLength>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Arc length"));
.arg(*data->GetVariable<VArcLength>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Arc length"));
ui->labelDescription->setText(desc);
return;
}
if (ui->radioButtonLengthSpline->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VSplineLength>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Curve length"));
.arg(*data->GetVariable<VSplineLength>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Curve length"));
ui->labelDescription->setText(desc);
return;
}
if (ui->radioButtonAngleLine->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VLineAngle>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Line Angle"));
.arg(*data->GetVariable<VLineAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Line Angle"));
ui->labelDescription->setText(desc);
return;
}
if (ui->radioButtonRadiusesArcs->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VArcRadius>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Arc radius"));
.arg(*data->GetVariable<VArcRadius>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Arc radius"));
ui->labelDescription->setText(desc);
return;
}
if (ui->radioButtonAnglesArcs->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VArcAngle>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Arc angle"));
.arg(*data->GetVariable<VArcAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Arc angle"));
ui->labelDescription->setText(desc);
return;
}
if (ui->radioButtonAnglesCurves->isChecked())
{
const QString desc = QString("%1(%2) - %3").arg(item->text())
.arg(*data->GetVariable<VCurveAngle>(qApp->VarFromUser(item->text()))->GetValue())
.arg(tr("Curve angle"));
.arg(*data->GetVariable<VCurveAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
.arg(tr("Curve angle"));
ui->labelDescription->setText(desc);
return;
}
@ -357,7 +359,7 @@ void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
@ -383,7 +385,7 @@ void DialogEditWrongFormula::setPostfix(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogEditWrongFormula::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogendline.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolendline.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h"
@ -195,7 +195,7 @@ void DialogEndLine::SetTypeLine(const QString &value)
*/
void DialogEndLine::SetFormula(const QString &value)
{
formulaLength = qApp->FormulaToUser(value);
formulaLength = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaLength.length() > 80)
@ -218,7 +218,7 @@ void DialogEndLine::SetFormula(const QString &value)
*/
void DialogEndLine::SetAngle(const QString &value)
{
formulaAngle = qApp->FormulaToUser(value);
formulaAngle = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaAngle.length() > 80)
@ -278,7 +278,7 @@ void DialogEndLine::ShowDialog(bool click)
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
qreal radius = qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
if (line.length() <= radius)
{
return;
@ -355,7 +355,7 @@ QString DialogEndLine::GetTypeLine() const
*/
QString DialogEndLine::GetFormula() const
{
return qApp->FormulaFromUser(formulaLength);
return qApp->TrVars()->FormulaFromUser(formulaLength, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@ -365,7 +365,7 @@ QString DialogEndLine::GetFormula() const
*/
QString DialogEndLine::GetAngle() const
{
return qApp->FormulaFromUser(formulaAngle);
return qApp->TrVars()->FormulaFromUser(formulaAngle, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogheight.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../tools/vabstracttool.h"
#include "../visualization/vistoolheight.h"
#include "../widgets/vmaingraphicsscene.h"

View File

@ -30,7 +30,7 @@
#include "ui_dialogline.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolline.h"
#include "../../core/vapplication.h"
#include "../../widgets/vmaingraphicsscene.h"

View File

@ -30,7 +30,7 @@
#include "ui_dialoglineintersect.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoollineintersect.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../xml/vpattern.h"

View File

@ -30,7 +30,7 @@
#include "ui_dialoglineintersectaxis.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoollineintersectaxis.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h"
@ -107,13 +107,13 @@ void DialogLineIntersectAxis::SetTypeLine(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogLineIntersectAxis::GetAngle() const
{
return qApp->FormulaFromUser(formulaAngle);
return qApp->TrVars()->FormulaFromUser(formulaAngle, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::SetAngle(const QString &value)
{
formulaAngle = qApp->FormulaToUser(value);
formulaAngle = qApp->TrVars()->FormulaToUser(value);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaAngle.length() > 80)
@ -203,7 +203,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
qreal radius = qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
if (line.length() <= radius)
{
return;

View File

@ -261,7 +261,7 @@ void DialogNormal::SetAngle(const qreal &value)
*/
void DialogNormal::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{
@ -315,7 +315,7 @@ QString DialogNormal::GetTypeLine() const
*/
QString DialogNormal::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogpointfromarcandtangent.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolpointfromarcandtangent.h"
#include "../../widgets/vmaingraphicsscene.h"

View File

@ -30,7 +30,7 @@
#include "ui_dialogpointfromcircleandtangent.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolpointfromcircleandtangent.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "dialogeditwrongformula.h"
@ -111,13 +111,14 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogPointFromCircleAndTangent::GetCircleRadius() const
{
return qApp->FormulaFromUser(ui->plainTextEditRadius->toPlainText());
return qApp->TrVars()->FormulaFromUser(ui->plainTextEditRadius->toPlainText(),
qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointFromCircleAndTangent::SetCircleRadius(const QString &value)
{
const QString formula = qApp->FormulaToUser(value);
const QString formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{

View File

@ -29,7 +29,7 @@
#include "dialogpointofcontact.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolpointofcontact.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../xml/vpattern.h"
@ -271,7 +271,7 @@ void DialogPointOfContact::setCenter(const quint32 &value)
*/
void DialogPointOfContact::setRadius(const QString &value)
{
radius = qApp->FormulaToUser(value);
radius = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (radius.length() > 80)
{
@ -304,7 +304,7 @@ void DialogPointOfContact::SetPointName(const QString &value)
*/
QString DialogPointOfContact::getRadius() const
{
return qApp->FormulaFromUser(radius);
return qApp->TrVars()->FormulaFromUser(radius, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogpointofintersection.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolpointofintersection.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../xml/vpattern.h"

View File

@ -30,7 +30,7 @@
#include "ui_dialogpointofintersectionarcs.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolpointofintersectionarcs.h"
#include "../../widgets/vmaingraphicsscene.h"

View File

@ -30,7 +30,7 @@
#include "ui_dialogpointofintersectioncircles.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolpointofintersectioncircles.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "dialogeditwrongformula.h"
@ -143,13 +143,14 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va
//---------------------------------------------------------------------------------------------------------------------
QString DialogPointOfIntersectionCircles::GetFirstCircleRadius() const
{
return qApp->FormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText());
return qApp->TrVars()->FormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value)
{
const QString formula = qApp->FormulaToUser(value);
const QString formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{
@ -167,13 +168,14 @@ void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value
//---------------------------------------------------------------------------------------------------------------------
QString DialogPointOfIntersectionCircles::GetSecondCircleRadius() const
{
return qApp->FormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText());
return qApp->TrVars()->FormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &value)
{
const QString formula = qApp->FormulaToUser(value);
const QString formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{

View File

@ -30,7 +30,7 @@
#include "ui_dialogshoulderpoint.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolshoulderpoint.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h"
@ -288,7 +288,7 @@ void DialogShoulderPoint::SetP1Line(const quint32 &value)
*/
void DialogShoulderPoint::SetFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
formula = qApp->TrVars()->FormulaToUser(value);
// increase height if needed.
if (formula.length() > 80)
{
@ -341,7 +341,7 @@ QString DialogShoulderPoint::GetTypeLine() const
*/
QString DialogShoulderPoint::GetFormula() const
{
return qApp->FormulaFromUser(formula);
return qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "ui_dialogspline.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolspline.h"
#include <QDebug>

View File

@ -29,7 +29,7 @@
#include "dialogsplinepath.h"
#include "ui_dialogsplinepath.h"
#include "../../libs/vgeometry/vsplinepoint.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistoolsplinepath.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -27,8 +27,8 @@
*************************************************************************/
#include "dialogtool.h"
#include "../../container/calculator.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../libs/vgeometry/varc.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../libs/vgeometry/vsplinepath.h"
@ -460,8 +460,9 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
// Replace line return character with spaces for calc if exist
QString formula = text;
formula.replace("\n", " ");
formula = qApp->FormulaFromUser(formula);// Translate to internal look.
Calculator *cal = new Calculator(data);
// Translate to internal look.
formula = qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
Calculator *cal = new Calculator(data, qApp->patternType());
result = cal->EvalFormula(formula);
delete cal;

View File

@ -29,7 +29,7 @@
#include "dialogtriangle.h"
#include "ui_dialogtriangle.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vcontainer.h"
#include "../../visualization/vistooltriangle.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../xml/vpattern.h"

View File

@ -28,8 +28,8 @@
#include "dialoguniondetails.h"
#include "ui_dialoguniondetails.h"
#include "../../geometry/vdetail.h"
#include "../../container/vcontainer.h"
#include "../../libs/vpatterndb/vdetail.h"
#include "../../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
/**

View File

@ -1,12 +0,0 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro
HEADERS += \
$$PWD/vnodedetail.h \
$$PWD/vdetail.h \
$$PWD/vnodedetail_p.h \
$$PWD/vdetail_p.h
SOURCES += \
$$PWD/vnodedetail.cpp \
$$PWD/vdetail.cpp

View File

@ -28,19 +28,12 @@
#include "mainwindow.h"
#include "core/vapplication.h"
#include "core/vsettings.h"
#include "version.h"
#include <QTextCodec>
#include <QMessageBox>
#include <QThread>
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
# include "../core/backport/qcommandlineparser.h"
#else
# include <QCommandLineParser>
#endif
#include <QtXml>
#include <QLibraryInfo>
//---------------------------------------------------------------------------------------------------------------------
int main(int argc, char *argv[])
@ -56,64 +49,7 @@ int main(int argc, char *argv[])
QT_REQUIRE_VERSION(argc, argv, "5.0.0");
VApplication app(argc, argv);
app.setApplicationDisplayName(VER_PRODUCTNAME_STR);
app.setApplicationName(VER_INTERNALNAME_STR);
app.setOrganizationName(VER_COMPANYNAME_STR);
app.setOrganizationDomain(VER_COMPANYDOMAIN_STR);
// Setting the Application version
app.setApplicationVersion(APP_VERSION_STR);
app.OpenSettings();
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
// Catch and send report
VApplication::DrMingw();
app.CollectReports();
#endif
// Run creation log after sending crash report
app.StartLogging();
qDebug()<<"Version:"<<APP_VERSION_STR;
qDebug()<<"Build revision:"<<BUILD_REVISION;
qDebug()<<buildCompatibilityString();
qDebug()<<"Built on"<<__DATE__<<"at"<<__TIME__;
qDebug()<<"Command-line arguments:"<<app.arguments();
qDebug()<<"Process ID:"<<app.applicationPid();
const QString checkedLocale = qApp->getSettings()->GetLocale();
qDebug()<<"Checked locale:"<<checkedLocale;
QTranslator qtTranslator;
#if defined(Q_OS_WIN)
qtTranslator.load("qt_" + checkedLocale, qApp->translationsPath());
#else
qtTranslator.load("qt_" + checkedLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
#endif
app.installTranslator(&qtTranslator);
QTranslator qtxmlTranslator;
#if defined(Q_OS_WIN)
qtxmlTranslator.load("qtxmlpatterns_" + checkedLocale, qApp->translationsPath());
#else
qtxmlTranslator.load("qtxmlpatterns_" + checkedLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
#endif
app.installTranslator(&qtxmlTranslator);
QTranslator appTranslator;
appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath());
app.installTranslator(&appTranslator);
static const char * GENERIC_ICON_TO_CHECK = "document-open";
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
{
//If there is no default working icon theme then we should
//use an icon theme that we provide via a .qrc file
//This case happens under Windows and Mac OS X
//This does not happen under GNOME or KDE
QIcon::setThemeName("win.icon.theme");
}
app.InitOptions();
MainWindow w;
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));

View File

@ -895,8 +895,8 @@ void MainWindow::ToolBarOption()
{
if (qApp->patternType() == MeasurementsType::Standard)
{
const QStringList listHeights = VMeasurement::ListHeights(doc->GetGradationHeights());
const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes());
const QStringList listHeights = VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit());
const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes(), qApp->patternUnit());
gradationHeights = SetGradationList(tr("Height: "), listHeights);
SetDefaultHeight(static_cast<int>(pattern->height()));
@ -1904,8 +1904,8 @@ void MainWindow::Layout()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::UpdateGradation()
{
UpdateHeightsList(VMeasurement::ListHeights(doc->GetGradationHeights()));
UpdateSizesList(VMeasurement::ListSizes(doc->GetGradationSizes()));
UpdateHeightsList(VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit()));
UpdateSizesList(VMeasurement::ListSizes(doc->GetGradationSizes(), qApp->patternUnit()));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -28,13 +28,13 @@
#include "mainwindowsnogui.h"
#include "../core/vapplication.h"
#include "../container/vcontainer.h"
#include "../../libs/vobj/vobjpaintdevice.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../libs/vobj/vobjpaintdevice.h"
#include "../dialogs/app/dialoglayoutsettings.h"
#include "../../libs/vlayout/vlayoutgenerator.h"
#include "../libs/vlayout/vlayoutgenerator.h"
#include "../dialogs/app/dialoglayoutprogress.h"
#include "../dialogs/app/dialogsavelayout.h"
#include "../../libs/vlayout/vposter.h"
#include "../libs/vlayout/vposter.h"
#include <QFileDialog>
#include <QFileInfo>
@ -57,9 +57,10 @@
//---------------------------------------------------------------------------------------------------------------------
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
: QMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr),
pattern(new VContainer()), doc(nullptr), papers(QList<QGraphicsItem *>()), shadows(QList<QGraphicsItem *>()),
scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), undoAction(nullptr),
redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()), isLayoutStale(true), isTiled(false)
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()),
shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()),
isLayoutStale(true), isTiled(false)
{
InitTempLayoutScene();
}
@ -502,7 +503,7 @@ void MainWindowsNoGUI::SvgFile(const QString &name, int i) const
generator.setViewBox(paper->rect());
generator.setTitle("Valentina. Pattern layout");
generator.setDescription(doc->GetDescription());
generator.setResolution(static_cast<int>(qApp->PrintDPI));
generator.setResolution(static_cast<int>(PrintDPI));
QPainter painter;
painter.begin(&generator);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
@ -556,7 +557,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
printer.setOutputFileName(name);
printer.setDocName(FileName());
const QRectF r = paper->rect();
printer.setResolution(static_cast<int>(qApp->PrintDPI));
printer.setResolution(static_cast<int>(PrintDPI));
// Set orientation
if (paper->rect().height()>= paper->rect().width())
{
@ -566,7 +567,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
{
printer.setOrientation(QPrinter::Landscape);
}
printer.setPaperSize ( QSizeF(qApp->fromPixel(r.width(), Unit::Mm), qApp->fromPixel(r.height(), Unit::Mm)),
printer.setPaperSize ( QSizeF(FromPixel(r.width(), Unit::Mm), FromPixel(r.height(), Unit::Mm)),
QPrinter::Millimeter );
QPainter painter;
if (painter.begin( &printer ) == false)
@ -652,7 +653,7 @@ void MainWindowsNoGUI::ObjFile(const QString &name, int i) const
VObjPaintDevice generator;
generator.setFileName(name);
generator.setSize(paper->rect().size().toSize());
generator.setResolution(static_cast<int>(qApp->PrintDPI));
generator.setResolution(static_cast<int>(PrintDPI));
QPainter painter;
painter.begin(&generator);
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
@ -730,7 +731,7 @@ void MainWindowsNoGUI::SaveLayoutAs()
qApp->getSettings()->SetPathLayout(f.absolutePath());
printer.setOutputFileName(fileName);
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
printer.setResolution(static_cast<int>(PrintDPI));
PrintPages( &printer );
}
}
@ -764,7 +765,7 @@ void MainWindowsNoGUI::PrintPreview()
}
QPrinter printer(def, QPrinter::ScreenResolution);
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
printer.setResolution(static_cast<int>(PrintDPI));
SetPrinterSettings(&printer);
// display print preview dialog
QPrintPreviewDialog preview(&printer);
@ -790,7 +791,7 @@ void MainWindowsNoGUI::LayoutPrint()
dialog.setOption(QPrintDialog::PrintCurrentPage, false);
if ( dialog.exec() == QDialog::Accepted )
{
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
printer.setResolution(static_cast<int>(PrintDPI));
PrintPages( &printer );
}
}
@ -820,8 +821,8 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer)
{
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
SCASSERT(paper != nullptr)
printer->setPaperSize ( QSizeF(qApp->fromPixel(paper->rect().width(), Unit::Mm),
qApp->fromPixel(paper->rect().height(), Unit::Mm)), QPrinter::Millimeter );
printer->setPaperSize ( QSizeF(FromPixel(paper->rect().width(), Unit::Mm),
FromPixel(paper->rect().height(), Unit::Mm)), QPrinter::Millimeter );
}
printer->setDocName(FileName());

View File

@ -31,7 +31,7 @@
#include <QMainWindow>
#include "../geometry/vdetail.h"
#include "../libs/vpatterndb/vdetail.h"
#include "../libs/vlayout/vlayoutdetail.h"
#include "xml/vpattern.h"

View File

@ -28,7 +28,6 @@
#include "options.h"
#include <QString>
#include <QStringList>
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
// furthermore blows up the binary sizes.
@ -36,192 +35,3 @@ const QString degreeSymbol = QStringLiteral("°");
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
// Keep synchronize all names with initialization in VApllication class!!!!!
//measurements
//head and neck
const QString headGirth_M = QStringLiteral("head_girth");
const QString midNeckGirth_M = QStringLiteral("mid_neck_girth");
const QString neckBaseGirth_M = QStringLiteral("neck_base_girth");
const QString headAndNeckLength_M = QStringLiteral("head_and_neck_length");
//torso
const QString centerFrontWaistLength_M = QStringLiteral("center_front_waist_length");
const QString centerBackWaistLength_M = QStringLiteral("center_back_waist_length");
const QString shoulderLength_M = QStringLiteral("shoulder_length");
const QString sideWaistLength_M = QStringLiteral("side_waist_length");
const QString trunkLength_M = QStringLiteral("trunk_length");
const QString shoulderGirth_M = QStringLiteral("shoulder_girth");
const QString upperChestGirth_M = QStringLiteral("upper_chest_girth");
const QString bustGirth_M = QStringLiteral("bust_girth");
const QString underBustGirth_M = QStringLiteral("under_bust_girth");
const QString waistGirth_M = QStringLiteral("waist_girth");
const QString highHipGirth_M = QStringLiteral("high_hip_girth");
const QString hipGirth_M = QStringLiteral("hip_girth");
const QString upperFrontChestWidth_M = QStringLiteral("upper_front_chest_width");
const QString frontChestWidth_M = QStringLiteral("front_chest_width");
const QString acrossFrontShoulderWidth_M = QStringLiteral("across_front_shoulder_width");
const QString acrossBackShoulderWidth_M = QStringLiteral("across_back_shoulder_width");
const QString upperBackWidth_M = QStringLiteral("upper_back_width");
const QString backWidth_M = QStringLiteral("back_width");
const QString bustpointToBustpoint_M = QStringLiteral("bustpoint_to_bustpoint");
const QString halterBustpointToBustpoint_M = QStringLiteral("halter_bustpoint_to_bustpoint");
const QString neckToBustpoint_M = QStringLiteral("neck_to_bustpoint");
const QString crotchLength_M = QStringLiteral("crotch_length");
const QString riseHeight_M = QStringLiteral("rise_height");
const QString shoulderDrop_M = QStringLiteral("shoulder_drop");
const QString shoulderSlopeDegrees_M = QStringLiteral("shoulder_slope_degrees");
const QString frontShoulderSlopeLength_M = QStringLiteral("front_shoulder_slope_length");
const QString backShoulderSlopeLength_M = QStringLiteral("back_shoulder_slope_length");
const QString frontShoulderToWaistLength_M = QStringLiteral("front_shoulder_to_waist_length");
const QString backShoulderToWaistLength_M = QStringLiteral("back_shoulder_to_waist_length");
const QString frontNeckArc_M = QStringLiteral("front_neck_arc");
const QString backNeckArc_M = QStringLiteral("back_neck_arc");
const QString frontUpperChestArc_M = QStringLiteral("front_upper_chest_arc");
const QString backUpperChestArc_M = QStringLiteral("back_upper_chest_arc");
const QString frontWaistArc_M = QStringLiteral("front_waist_arc");
const QString backWaistArc_M = QStringLiteral("back_waist_arc");
const QString frontUpperHipArc_M = QStringLiteral("front_upper_hip_arc");
const QString backUpperHipArc_M = QStringLiteral("back_upper_hip_arc");
const QString frontHipArc_M = QStringLiteral("front_hip_arc");
const QString backHipArc_M = QStringLiteral("back_hip_arc");
const QString chestSlope_M = QStringLiteral("chest_slope");
const QString backSlope_M = QStringLiteral("back_slope");
const QString frontWaistSlope_M = QStringLiteral("front_waist_slope");
const QString backWaistSlope_M = QStringLiteral("back_waist_slope");
const QString frontNeckToUpperChestHeight_M = QStringLiteral("front_neck_to_upper_chest_height");
const QString frontNeckToBustHeight_M = QStringLiteral("front_neck_to_bust_height");
const QString frontWaistToUpperChest_M = QStringLiteral("front_waist_to_upper_chest");
const QString frontWaistToLowerBreast_M = QStringLiteral("front_waist_to_lower_breast");
const QString backWaistToUpperChest_M = QStringLiteral("back_waist_to_upper_chest");
const QString strapLength_M = QStringLiteral("strap_length");
//arm
const QString armscyeGirth_M = QStringLiteral("armscye_girth");
const QString elbowGirth_M = QStringLiteral("elbow_girth");
const QString upperArmGirth_M = QStringLiteral("upper_arm_girth");
const QString wristGirth_M = QStringLiteral("wrist_girth");
const QString scyeDepth_M = QStringLiteral("scye_depth");
const QString shoulderAndArmLength_M = QStringLiteral("shoulder_and_arm_length");
const QString underarmLength_M = QStringLiteral("underarm_length");
const QString cervicaleToWristLength_M = QStringLiteral("cervicale_to_wrist_length");
const QString shoulderToElbowLength_M = QStringLiteral("shoulder_to_elbow_length");
const QString armLength_M = QStringLiteral("arm_length");
//hand
const QString handWidth_M = QStringLiteral("hand_width");
const QString handLength_M = QStringLiteral("hand_length");
const QString handGirth_M = QStringLiteral("hand_girth");
//leg
const QString thighGirth_M = QStringLiteral("thigh_girth");
const QString midThighGirth_M = QStringLiteral("mid_thigh_girth");
const QString kneeGirth_M = QStringLiteral("knee_girth");
const QString calfGirth_M = QStringLiteral("calf_girth");
const QString ankleGirth_M = QStringLiteral("ankle_girth");
const QString kneeHeight_M = QStringLiteral("knee_height");
const QString ankleHeight_M = QStringLiteral("ankle_height");
//foot
const QString footWidth_M = QStringLiteral("foot_width");
const QString footLength_M = QStringLiteral("foot_length");
//heights
const QString height_M = QStringLiteral("height");
const QString cervicaleHeight_M = QStringLiteral("cervicale_height");
const QString cervicaleToKneeHeight_M = QStringLiteral("cervicale_to_knee_height");
const QString waistHeight_M = QStringLiteral("waist_height");
const QString highHipHeight_M = QStringLiteral("high_hip_height");
const QString hipHeight_M = QStringLiteral("hip_height");
const QString waistToHipHeight_M = QStringLiteral("waist_to_hip_height");
const QString waistToKneeHeight_M = QStringLiteral("waist_to_knee_height");
const QString crotchHeight_M = QStringLiteral("crotch_height");
//extended measurements
const QString size_M = QStringLiteral("size");
const QString heightFrontNeckBasePoint_M = QStringLiteral("height_front_neck_base_point");
const QString heightBaseNeckSidePoint_M = QStringLiteral("height_base_neck_side_point");
const QString heightShoulderPoint_M = QStringLiteral("height_shoulder_point");
const QString heightNipplePoint_M = QStringLiteral("height_nipple_point");
const QString heightBackAngleAxilla_M = QStringLiteral("height_back_angle_axilla");
const QString heightScapularPoint_M = QStringLiteral("height_scapular_point");
const QString heightUnderButtockFolds_M = QStringLiteral("height_under_buttock_folds");
const QString hipsExcludingProtrudingAbdomen_M = QStringLiteral("hips_excluding_protruding_abdomen");
const QString girthFootInstep_M = QStringLiteral("girth_foot_instep");
const QString sideWaistToFloor_M = QStringLiteral("side_waist_to_floor");
const QString frontWaistToFloor_M = QStringLiteral("front_waist_to_floor");
const QString arcThroughGroinArea_M = QStringLiteral("arc_through_groin_area");
const QString waistToPlaneSeat_M = QStringLiteral("waist_to_plane_seat");
const QString neckToRadialPoint_M = QStringLiteral("neck_to_radial_point");
const QString neckToThirdFinger_M = QStringLiteral("neck_to_third_finger");
const QString neckToFirstLineChestCircumference_M = QStringLiteral("neck_to_first_line_chest_circumference");
const QString frontWaistLength_M = QStringLiteral("front_waist_length");
const QString arcThroughShoulderJoint_M = QStringLiteral("arc_through_shoulder_joint");
const QString neckToBackLineChestCircumference_M = QStringLiteral("neck_to_back_line_chest_circumference");
const QString waistToNeckSide_M = QStringLiteral("waist_to_neck_side");
const QString arcLengthUpperBody_M = QStringLiteral("arc_length_upper_body");
const QString chestWidth_M = QStringLiteral("chest_width");
const QString anteroposteriorDiameterHands_M = QStringLiteral("anteroposterior_diameter_hands");
const QString heightClavicularPoint_M = QStringLiteral("height_clavicular_point");
const QString heightArmholeSlash_M = QStringLiteral("height_armhole_slash");
const QString slashShoulderHeight_M = QStringLiteral("slash_shoulder_height");
const QString halfGirthNeck_M = QStringLiteral("half_girth_neck");
const QString halfGirthNeckForShirts_M = QStringLiteral("half_girth_neck_for_shirts");
const QString halfGirthChestFirst_M = QStringLiteral("half_girth_chest_first");
const QString halfGirthChestSecond_M = QStringLiteral("half_girth_chest_second");
const QString halfGirthChestThird_M = QStringLiteral("half_girth_chest_third");
const QString halfGirthWaist_M = QStringLiteral("half_girth_waist");
const QString halfGirthHipsConsideringProtrudingAbdomen_M
= QStringLiteral("half_girth_hips_considering_protruding_abdomen");
const QString halfGirthHipsExcludingProtrudingAbdomen_M
= QStringLiteral("half_girth_hips_excluding_protruding_abdomen");
const QString girthKneeFlexedFeet_M = QStringLiteral("girth_knee_flexed_feet");
const QString neckTransverseDiameter_M = QStringLiteral("neck_transverse_diameter");
const QString frontSlashShoulderHeight_M = QStringLiteral("front_slash_shoulder_height");
const QString neckToFrontWaistLine_M = QStringLiteral("neck_to_front_waist_line");
const QString handVerticalDiameter_M = QStringLiteral("hand_vertical_diameter");
const QString neckToKneePoint_M = QStringLiteral("neck_to_knee_point");
const QString waistToKnee_M = QStringLiteral("waist_to_knee");
const QString shoulderHeight_M = QStringLiteral("shoulder_height");
const QString headHeight_M = QStringLiteral("head_height");
const QString bodyPosition_M = QStringLiteral("body_position");
const QString arcBehindShoulderGirdle_M = QStringLiteral("arc_behind_shoulder_girdle");
const QString neckToNeckBase_M = QStringLiteral("neck_to_neck_base");
const QString depthWaistFirst_M = QStringLiteral("depth_waist_first");
const QString depthWaistSecond_M = QStringLiteral("depth_waist_second");
//variables
const QString line_ = QStringLiteral("Line_");
const QString angleLine_ = QStringLiteral("AngleLine_");
//functions
const QString sin_F = QStringLiteral("sin");
const QString cos_F = QStringLiteral("cos");
const QString tan_F = QStringLiteral("tan");
const QString asin_F = QStringLiteral("asin");
const QString acos_F = QStringLiteral("acos");
const QString atan_F = QStringLiteral("atan");
const QString sinh_F = QStringLiteral("sinh");
const QString cosh_F = QStringLiteral("cosh");
const QString tanh_F = QStringLiteral("tanh");
const QString asinh_F = QStringLiteral("asinh");
const QString acosh_F = QStringLiteral("acosh");
const QString atanh_F = QStringLiteral("atanh");
const QString log2_F = QStringLiteral("log2");
const QString log10_F = QStringLiteral("log10");
const QString log_F = QStringLiteral("log");
const QString ln_F = QStringLiteral("ln");
const QString exp_F = QStringLiteral("exp");
const QString sqrt_F = QStringLiteral("sqrt");
const QString sign_F = QStringLiteral("sign");
const QString rint_F = QStringLiteral("rint");
const QString abs_F = QStringLiteral("abs");
const QString min_F = QStringLiteral("min");
const QString max_F = QStringLiteral("max");
const QString sum_F = QStringLiteral("sum");
const QString avg_F = QStringLiteral("avg");
const QString fmod_F = QStringLiteral("fmod");
const QStringList builInFunctions = QStringList() << sin_F << cos_F << tan_F << asin_F << acos_F << atan_F
<< sinh_F << cosh_F << tanh_F << asinh_F << acosh_F << atanh_F
<< log2_F << log10_F << log_F << ln_F << exp_F << sqrt_F
<< sign_F << rint_F << abs_F << min_F << max_F << sum_F
<< avg_F << fmod_F;
// Postfix operators
const QString cm_Oprt = QStringLiteral("cm");
const QString mm_Oprt = QStringLiteral("mm");
const QString in_Oprt = QStringLiteral("in");

View File

@ -56,274 +56,9 @@ extern const QString cursorArrowOpenHand;
extern const QString cursorArrowCloseHand;
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
enum class Tool : unsigned char
{
Arrow,
Point,
LinePoint,
AbstractSpline,
Cut,
SinglePoint,
EndLine,
Line,
AlongLine,
ShoulderPoint,
Normal,
Bisector,
LineIntersect,
Spline,
CutSpline,
CutArc,
Arc,
ArcWithLength,
SplinePath,
CutSplinePath,
PointOfContact,
Detail,
NodePoint,
NodeArc,
NodeSpline,
NodeSplinePath,
Height,
Triangle,
LineIntersectAxis,
PointOfIntersectionArcs,
PointOfIntersectionCircles,
CurveIntersectAxis,
PointOfIntersection,
PointFromCircleAndTangent,
PointFromArcAndTangent,
UnionDetails // 35
};
enum class Vis : unsigned char
{
ControlPointSpline = 36, // increase this value if need more positions in Tool enum
GraphicsSimpleTextItem,
SimpleSplinePath,
Line,
Path,
ToolAlongLine,
ToolArc,
ToolArcWithLength,
ToolBisector,
ToolCutArc,
ToolEndLine,
ToolHeight,
ToolLine,
ToolLineIntersect,
ToolNormal,
ToolPointOfContact,
ToolPointOfIntersection,
ToolPointOfIntersectionArcs,
ToolPointOfIntersectionCircles,
ToolPointFromCircleAndTangent,
ToolPointFromArcAndTangent,
ToolShoulderPoint,
ToolSpline,
ToolTriangle,
ToolCutSpline,
ToolSplinePath,
ToolCutSplinePath,
ToolLineIntersectAxis,
ToolCurveIntersectAxis
};
enum class Source : char { FromGui, FromFile, FromTool };
enum class NodeDetail : char { Contour, Modeling };
enum class Contour : char { OpenContour, CloseContour };
enum class VarType : char { Measurement, Increment, LineLength, SplineLength, ArcLength, ArcRadius, LineAngle, ArcAngle,
SplineAngle, Unknown };
enum class GHeights : unsigned char { ALL,
H92=92, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134,
H140=140, H146=146, H152=152, H158=158, H164=164, H170=170, H176=176, H182=182,
H188=188, H194=194};
enum class GSizes : unsigned char { ALL,
S22=22, S24=24, S26=26, S28=28, S30=30, S32=32, S34=34, S36=36, S38=38, S40=40,
S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56 };
// measurements
//head and neck
extern const QString headGirth_M;
extern const QString midNeckGirth_M;
extern const QString neckBaseGirth_M;
extern const QString headAndNeckLength_M;
//torso
extern const QString centerFrontWaistLength_M;
extern const QString centerBackWaistLength_M;
extern const QString shoulderLength_M;
extern const QString sideWaistLength_M;
extern const QString trunkLength_M;
extern const QString shoulderGirth_M;
extern const QString upperChestGirth_M;
extern const QString bustGirth_M;
extern const QString underBustGirth_M;
extern const QString waistGirth_M;
extern const QString highHipGirth_M;
extern const QString hipGirth_M;
extern const QString upperFrontChestWidth_M;
extern const QString frontChestWidth_M;
extern const QString acrossFrontShoulderWidth_M;
extern const QString acrossBackShoulderWidth_M;
extern const QString upperBackWidth_M;
extern const QString backWidth_M;
extern const QString bustpointToBustpoint_M;
extern const QString halterBustpointToBustpoint_M;
extern const QString neckToBustpoint_M;
extern const QString crotchLength_M;
extern const QString riseHeight_M;
extern const QString shoulderDrop_M;
extern const QString shoulderSlopeDegrees_M;
extern const QString frontShoulderSlopeLength_M;
extern const QString backShoulderSlopeLength_M;
extern const QString frontShoulderToWaistLength_M;
extern const QString backShoulderToWaistLength_M;
extern const QString frontNeckArc_M;
extern const QString backNeckArc_M;
extern const QString frontUpperChestArc_M;
extern const QString backUpperChestArc_M;
extern const QString frontWaistArc_M;
extern const QString backWaistArc_M;
extern const QString frontUpperHipArc_M;
extern const QString backUpperHipArc_M;
extern const QString frontHipArc_M;
extern const QString backHipArc_M;
extern const QString chestSlope_M;
extern const QString backSlope_M;
extern const QString frontWaistSlope_M;
extern const QString backWaistSlope_M;
extern const QString frontNeckToUpperChestHeight_M;
extern const QString frontNeckToBustHeight_M;
extern const QString frontWaistToUpperChest_M;
extern const QString frontWaistToLowerBreast_M;
extern const QString backWaistToUpperChest_M;
extern const QString strapLength_M;
//arm
extern const QString armscyeGirth_M;
extern const QString elbowGirth_M;
extern const QString upperArmGirth_M;
extern const QString wristGirth_M;
extern const QString scyeDepth_M;
extern const QString shoulderAndArmLength_M;
extern const QString underarmLength_M;
extern const QString cervicaleToWristLength_M;
extern const QString shoulderToElbowLength_M;
extern const QString armLength_M;
//hand
extern const QString handWidth_M;
extern const QString handLength_M;
extern const QString handGirth_M;
//leg
extern const QString thighGirth_M;
extern const QString midThighGirth_M;
extern const QString kneeGirth_M;
extern const QString calfGirth_M;
extern const QString ankleGirth_M;
extern const QString kneeHeight_M;
extern const QString ankleHeight_M;
//foot
extern const QString footWidth_M;
extern const QString footLength_M;
//heights
extern const QString height_M;
extern const QString cervicaleHeight_M;
extern const QString cervicaleToKneeHeight_M;
extern const QString waistHeight_M;
extern const QString highHipHeight_M;
extern const QString hipHeight_M;
extern const QString waistToHipHeight_M;
extern const QString waistToKneeHeight_M;
extern const QString crotchHeight_M;
//extended measurements
extern const QString size_M;
extern const QString heightFrontNeckBasePoint_M;
extern const QString heightBaseNeckSidePoint_M;
extern const QString heightShoulderPoint_M;
extern const QString heightNipplePoint_M;
extern const QString heightBackAngleAxilla_M;
extern const QString heightScapularPoint_M;
extern const QString heightUnderButtockFolds_M;
extern const QString hipsExcludingProtrudingAbdomen_M;
extern const QString girthFootInstep_M;
extern const QString sideWaistToFloor_M;
extern const QString frontWaistToFloor_M;
extern const QString arcThroughGroinArea_M;
extern const QString waistToPlaneSeat_M;
extern const QString neckToRadialPoint_M;
extern const QString neckToThirdFinger_M;
extern const QString neckToFirstLineChestCircumference_M;
extern const QString frontWaistLength_M;
extern const QString arcThroughShoulderJoint_M;
extern const QString neckToBackLineChestCircumference_M;
extern const QString waistToNeckSide_M;
extern const QString arcLengthUpperBody_M;
extern const QString chestWidth_M;
extern const QString anteroposteriorDiameterHands_M;
extern const QString heightClavicularPoint_M;
extern const QString heightArmholeSlash_M;
extern const QString slashShoulderHeight_M;
extern const QString halfGirthNeck_M;
extern const QString halfGirthNeckForShirts_M;
extern const QString halfGirthChestFirst_M;
extern const QString halfGirthChestSecond_M;
extern const QString halfGirthChestThird_M;
extern const QString halfGirthWaist_M;
extern const QString halfGirthHipsConsideringProtrudingAbdomen_M;
extern const QString halfGirthHipsExcludingProtrudingAbdomen_M;
extern const QString girthKneeFlexedFeet_M;
extern const QString neckTransverseDiameter_M;
extern const QString frontSlashShoulderHeight_M;
extern const QString neckToFrontWaistLine_M;
extern const QString handVerticalDiameter_M;
extern const QString neckToKneePoint_M;
extern const QString waistToKnee_M;
extern const QString shoulderHeight_M;
extern const QString headHeight_M;
extern const QString bodyPosition_M;
extern const QString arcBehindShoulderGirdle_M;
extern const QString neckToNeckBase_M;
extern const QString depthWaistFirst_M;
extern const QString depthWaistSecond_M;
// variables name
extern const QString line_;
extern const QString angleLine_;
// functions
extern const QString sin_F;
extern const QString cos_F;
extern const QString tan_F;
extern const QString asin_F;
extern const QString acos_F;
extern const QString atan_F;
extern const QString sinh_F;
extern const QString cosh_F;
extern const QString tanh_F;
extern const QString asinh_F;
extern const QString acosh_F;
extern const QString atanh_F;
extern const QString log2_F;
extern const QString log10_F;
extern const QString log_F;
extern const QString ln_F;
extern const QString exp_F;
extern const QString sqrt_F;
extern const QString sign_F;
extern const QString rint_F;
extern const QString abs_F;
extern const QString min_F;
extern const QString max_F;
extern const QString sum_F;
extern const QString avg_F;
extern const QString fmod_F;
extern const QStringList builInFunctions;
// Postfix operators
extern const QString cm_Oprt;
extern const QString mm_Oprt;
extern const QString in_Oprt;
#endif // OPTIONS_H

View File

@ -31,7 +31,7 @@
#include <qmuparsererror.h>
#include "../dialogs/tools/dialogeditwrongformula.h"
#include "../dialogs/app/dialogundo.h"
#include "../container/calculator.h"
#include "../libs/vpatterndb/calculator.h"
#include "../../undocommands/addtocalc.h"
#include "../../undocommands/savetooloptions.h"
#include "../../libs/ifc/exception/vexceptionundo.h"
@ -285,7 +285,7 @@ qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContaine
Calculator *cal = nullptr;
try
{
cal = new Calculator(data);
cal = new Calculator(data, qApp->patternType());
result = cal->EvalFormula(formula);
delete cal;
}
@ -316,7 +316,7 @@ qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContaine
/* Need delete dialog here because parser in dialog don't allow use correct separator for
* parsing here. */
delete dialog;
Calculator *cal1 = new Calculator(data);
Calculator *cal1 = new Calculator(data, qApp->patternType());
result = cal1->EvalFormula(formula);
delete cal1; /* Here can be memory leak, but dialog already check this formula and probability
* very low. */

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolalongline.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogalongline.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../libs/ifc/exception/vexceptionobjecterror.h"
@ -136,7 +136,7 @@ void VToolAlongLine::SetVisualization()
SCASSERT(visual != nullptr)
visual->setPoint1Id(basePointId);
visual->setPoint2Id(secondPointId);
visual->setLength(qApp->FormulaToUser(formulaLength));
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();
}

View File

@ -27,10 +27,10 @@
*************************************************************************/
#include "vtoolarc.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogarc.h"
#include "../../libs/vgeometry/varc.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
#include "../../visualization/vistoolarc.h"
#include <QKeyEvent>
@ -345,9 +345,9 @@ void VToolArc::SetVisualization()
SCASSERT(visual != nullptr)
visual->setPoint1Id(arc->GetCenter().id());
visual->setRadius(qApp->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(qApp->FormulaToUser(arc->GetFormulaF1()));
visual->setF2(qApp->FormulaToUser(arc->GetFormulaF2()));
visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1()));
visual->setF2(qApp->TrVars()->FormulaToUser(arc->GetFormulaF2()));
visual->RefreshGeometry();
}
}

View File

@ -27,10 +27,10 @@
*************************************************************************/
#include "vtoolarcwithlength.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogarcwithlength.h"
#include "../../libs/vgeometry/varc.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
#include "../../visualization/vistoolarcwithlength.h"
#include <QKeyEvent>
@ -302,9 +302,9 @@ void VToolArcWithLength::SetVisualization()
SCASSERT(visual != nullptr)
visual->setPoint1Id(arc->GetCenter().id());
visual->setRadius(qApp->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(qApp->FormulaToUser(arc->GetFormulaF1()));
visual->setLength(qApp->FormulaToUser(arc->GetFormulaLength()));
visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1()));
visual->setLength(qApp->TrVars()->FormulaToUser(arc->GetFormulaLength()));
visual->RefreshGeometry();
}
}

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolbisector.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogbisector.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../visualization/vistoolbisector.h"
@ -296,7 +296,7 @@ void VToolBisector::SetVisualization()
visual->setPoint1Id(firstPointId);
visual->setPoint2Id(basePointId);
visual->setPoint3Id(thirdPointId);
visual->setLength(qApp->FormulaToUser(formulaLength));
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();
}

View File

@ -28,7 +28,7 @@
#include "vtoolcurveintersectaxis.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogcurveintersectaxis.h"
#include "../../dialogs/tools/dialogeditwrongformula.h"
#include "../../libs/vgeometry/vpointf.h"
@ -269,7 +269,7 @@ void VToolCurveIntersectAxis::SetVisualization()
visual->setPoint1Id(curveId);
visual->setAxisPointId(basePointId);
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();
}

View File

@ -28,7 +28,7 @@
#include "vtoolcut.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vformula.h"
#include "../../core/vformula.h"
//---------------------------------------------------------------------------------------------------------------------
VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolcutarc.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogcutarc.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../libs/vgeometry/varc.h"
@ -269,7 +269,7 @@ void VToolCutArc::SetVisualization()
SCASSERT(visual != nullptr);
visual->setPoint1Id(curveCutId);
visual->setLength(qApp->FormulaToUser(formula));
visual->setLength(qApp->TrVars()->FormulaToUser(formula));
visual->RefreshGeometry();
}
}

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolcutspline.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogcutspline.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../visualization/vistoolcutspline.h"
@ -279,7 +279,7 @@ void VToolCutSpline::SetVisualization()
SCASSERT(visual != nullptr);
visual->setPoint1Id(curveCutId);
visual->setLength(qApp->FormulaToUser(formula));
visual->setLength(qApp->TrVars()->FormulaToUser(formula));
visual->RefreshGeometry();
}
}

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolcutsplinepath.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogcutsplinepath.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../visualization/vistoolcutsplinepath.h"
@ -325,7 +325,7 @@ void VToolCutSplinePath::SetVisualization()
SCASSERT(visual != nullptr);
visual->setPoint1Id(curveCutId);
visual->setLength(qApp->FormulaToUser(formula));
visual->setLength(qApp->TrVars()->FormulaToUser(formula));
visual->RefreshGeometry();
}
}

View File

@ -28,7 +28,7 @@
#include "vtoolendline.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogendline.h"
#include "../../dialogs/tools/dialogeditwrongformula.h"
#include "../../libs/vgeometry/vpointf.h"
@ -231,8 +231,8 @@ void VToolEndLine::SetVisualization()
SCASSERT(visual != nullptr);
visual->setPoint1Id(basePointId);
visual->setLength(qApp->FormulaToUser(formulaLength));
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();
}

View File

@ -28,7 +28,7 @@
#include "vtoollineintersectaxis.h"
#include "../../widgets/vmaingraphicsscene.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialoglineintersectaxis.h"
#include "../../dialogs/tools/dialogeditwrongformula.h"
#include "../../libs/vgeometry/vpointf.h"
@ -285,7 +285,7 @@ void VToolLineIntersectAxis::SetVisualization()
visual->setPoint1Id(firstPointId);
visual->setPoint2Id(secondPointId);
visual->setAxisPointId(basePointId);
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();
}

View File

@ -30,7 +30,7 @@
#define VTOOLLINEPOINT_H
#include "vtoolpoint.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
/**
* @brief The VToolLinePoint class parent for all tools what create point with line.

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolnormal.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialognormal.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../visualization/vistoolnormal.h"
@ -272,7 +272,7 @@ void VToolNormal::SetVisualization()
visual->setPoint1Id(basePointId);
visual->setPoint2Id(secondPointId);
visual->setLength(qApp->FormulaToUser(formulaLength));
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->SetAngle(angle);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();

View File

@ -50,7 +50,7 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
:VDrawTool(doc, data, id), QGraphicsEllipseItem(parent), radius(DefPointRadius), namePoint(nullptr),
lineName(nullptr)
{
radius = qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm);
radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm);
namePoint = new VGraphicsSimpleTextItem(this);
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::contextMenuEvent);
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolPoint::DeleteFromLabel);
@ -279,7 +279,7 @@ void VToolPoint::RefreshLine()
lineName->setLine(QLineF(p1, pRec - scenePos()));
lineName->setPen(QPen(CorrectColor(Qt::black), qApp->toPixel(qApp->widthHairLine())/factor));
if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm))
if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm))
{
lineName->setVisible(false);
}

View File

@ -31,7 +31,7 @@
#include "../../libs/vgeometry/vpointf.h"
#include "../../libs/vgeometry/varc.h"
#include "../../visualization/vistoolpointfromcircleandtangent.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
const QString VToolPointFromCircleAndTangent::ToolType = QStringLiteral("pointFromCircleAndTangent");

View File

@ -27,10 +27,10 @@
*************************************************************************/
#include "vtoolpointofcontact.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogpointofcontact.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../container/vformula.h"
#include "../../core/vformula.h"
#include "../../visualization/vistoolpointofcontact.h"
#include <QtCore/qmath.h>
@ -313,7 +313,7 @@ void VToolPointOfContact::SetVisualization()
visual->setPoint1Id(firstPointId);
visual->setLineP2Id(secondPointId);
visual->setRadiusId(center);
visual->setRadius(qApp->FormulaToUser(arcRadius));
visual->setRadius(qApp->TrVars()->FormulaToUser(arcRadius));
visual->RefreshGeometry();
}
}

View File

@ -31,7 +31,7 @@
#include "../../libs/vgeometry/vpointf.h"
#include "../../libs/vgeometry/varc.h"
#include "../../visualization/vistoolpointofintersectioncircles.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
const QString VToolPointOfIntersectionCircles::ToolType = QStringLiteral("pointOfIntersectionCircles");

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vtoolshoulderpoint.h"
#include "../../container/calculator.h"
#include "../../libs/vpatterndb/calculator.h"
#include "../../dialogs/tools/dialogshoulderpoint.h"
#include "../../libs/vgeometry/vpointf.h"
#include "../../visualization/vistoolshoulderpoint.h"
@ -300,7 +300,7 @@ void VToolShoulderPoint::SetVisualization()
visual->setPoint1Id(pShoulder);
visual->setLineP1Id(basePointId);
visual->setLineP2Id(p2Line);
visual->setLength(qApp->FormulaToUser(formulaLength));
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry();
}

View File

@ -55,7 +55,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo
:VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(0),
namePoint(nullptr), lineName(nullptr)
{
radius = qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm);
radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm);
namePoint = new VGraphicsSimpleTextItem(this);
lineName = new QGraphicsLineItem(this);
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
@ -286,7 +286,7 @@ void VNodePoint::RefreshLine()
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - scenePos()));
if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm))
if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm))
{
lineName->setVisible(false);
}

View File

@ -29,7 +29,7 @@
#ifndef VDATATOOL_H
#define VDATATOOL_H
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../../utils/logging.h"
Q_DECLARE_LOGGING_CATEGORY(vTool)

View File

@ -49,7 +49,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointP
:QGraphicsEllipseItem(parent), radius(0), controlLine(nullptr), indexSpline(indexSpline), position(position)
{
//create circle
radius = (1.5/*mm*/ / 25.4) * VApplication::PrintDPI;
radius = (1.5/*mm*/ / 25.4) * PrintDPI;
QRectF rec = QRectF(0, 0, radius*2, radius*2);
rec.translate(-rec.center().x(), -rec.center().y());
this->setRect(rec);

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolalongline.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../libs/vgeometry/vpointf.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
#include "vistoolarc.h"
#include "../libs/vgeometry/vpointf.h"
#include "../libs/vgeometry/varc.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolArc::VisToolArc(const VContainer *data, QGraphicsItem *parent)

View File

@ -29,7 +29,7 @@
#include "vistoolarcwithlength.h"
#include "../libs/vgeometry/vpointf.h"
#include "../libs/vgeometry/varc.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolArcWithLength::VisToolArcWithLength(const VContainer *data, QGraphicsItem *parent)

View File

@ -28,7 +28,7 @@
#include "vistoolbisector.h"
#include "../libs/vgeometry/vpointf.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/drawTools/vtoolbisector.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolcurveintersectaxis.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../libs/vgeometry/vpointf.h"
#include "../tools/drawTools/vtoolcurveintersectaxis.h"

View File

@ -28,7 +28,7 @@
#include "vistoolcutarc.h"
#include "../libs/vgeometry/varc.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolCutArc::VisToolCutArc(const VContainer *data, QGraphicsItem *parent)

View File

@ -28,7 +28,7 @@
#include "vistoolcutspline.h"
#include "../libs/vgeometry/vspline.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolCutSpline::VisToolCutSpline(const VContainer *data, QGraphicsItem *parent)

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolcutsplinepath.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../libs/vgeometry/vsplinepath.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -28,7 +28,7 @@
#include "vistoolendline.h"
#include "../libs/vgeometry/vpointf.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/vabstracttool.h"
#include <QGraphicsScene>

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolline.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../libs/vgeometry/vpointf.h"
#include "../tools/drawTools/vdrawtool.h"

View File

@ -28,7 +28,7 @@
#include "vistoollineintersect.h"
#include "../libs/vgeometry/vpointf.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolLineIntersect::VisToolLineIntersect(const VContainer *data, QGraphicsItem *parent)

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoollineintersectaxis.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../libs/vgeometry/vpointf.h"
#include "../tools/drawTools/vtoollineintersectaxis.h"

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolpointfromarcandtangent.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/drawTools/vtoolpointfromarcandtangent.h"
#include "../libs/vgeometry/vpointf.h"
#include "../libs/vgeometry/varc.h"
@ -99,12 +99,9 @@ void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
case 2:
{
int localRes = 0;
bool flagP1 = false;
if (arc->IsIntersectLine(r1Arc))
{
++localRes;
flagP1 = true;
}
if (arc->IsIntersectLine(r2Arc))

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolpointfromcircleandtangent.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/drawTools/vtoolpointfromcircleandtangent.h"
#include "../libs/vgeometry/vpointf.h"

View File

@ -28,7 +28,7 @@
#include "vistoolpointofintersection.h"
#include "../libs/vgeometry/vpointf.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
VisToolPointOfIntersection::VisToolPointOfIntersection(const VContainer *data, QGraphicsItem *parent)

View File

@ -28,7 +28,7 @@
#include "vistoolpointofintersectionarcs.h"
#include "../libs/vgeometry/varc.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/drawTools/vtoolpointofintersectionarcs.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -27,7 +27,7 @@
*************************************************************************/
#include "vistoolpointofintersectioncircles.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/drawTools/vtoolpointofintersectioncircles.h"
#include "../libs/vgeometry/vpointf.h"

View File

@ -29,7 +29,7 @@
#include "vistoolspline.h"
#include "../libs/vgeometry/vpointf.h"
#include "../libs/vgeometry/vspline.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
const int EMPTY_ANGLE = -1;

View File

@ -28,7 +28,7 @@
#include "vistooltriangle.h"
#include "../libs/vgeometry/vpointf.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
#include "../tools/drawTools/vtooltriangle.h"
#include <QtCore/qmath.h>

View File

@ -28,7 +28,7 @@
#include "visualization.h"
#include "../tools/drawTools/vdrawtool.h"
#include "../container/calculator.h"
#include "../libs/vpatterndb/calculator.h"
#include <QGraphicsEllipseItem>
@ -110,7 +110,7 @@ QGraphicsEllipseItem *Visualization::InitPoint(const QColor &color, QGraphicsIte
point->setZValue(1);
point->setBrush(QBrush(Qt::NoBrush));
point->setPen(QPen(color, qApp->toPixel(qApp->widthMainLine())/factor));
point->setRect(PointRect(qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm)));
point->setRect(PointRect(ToPixel(DefPointRadius/*mm*/, Unit::Mm)));
point->setFlags(QGraphicsItem::ItemStacksBehindParent);
point->setVisible(false);
return point;
@ -145,8 +145,8 @@ qreal Visualization::FindVal(const QString &expression)
// Replace line return with spaces for calc if exist
QString formula = expression;
formula.replace("\n", " ");
formula = qApp->FormulaFromUser(formula);
Calculator *cal = new Calculator(Visualization::data);
formula = qApp->TrVars()->FormulaFromUser(formula, qApp->getSettings()->GetOsSeparator());
Calculator *cal = new Calculator(Visualization::data, qApp->patternType());
val = cal->EvalFormula(formula);
delete cal;
}

View File

@ -29,7 +29,7 @@
#include "textdelegate.h"
#include <QLineEdit>
#include "../options.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
/**

View File

@ -32,7 +32,7 @@
#include "../../libs/vpropertyexplorer/vproperty_p.h"
#include "vformulapropertyeditor.h"
#include "../../libs/vpropertyexplorer/vproperties.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2};
@ -72,6 +72,7 @@ QVariant VFormulaProperty::data (int column, int role) const
}
}
//---------------------------------------------------------------------------------------------------------------------
Qt::ItemFlags VFormulaProperty::flags(int column) const
{
if (column == DPC_Name || column == DPC_Data)

View File

@ -35,7 +35,7 @@
#include <QLabel>
#include <QSpacerItem>
#include "../container/vformula.h"
#include "../core/vformula.h"
class VFormulaPropertyEditor : public QWidget
{

View File

@ -34,7 +34,7 @@
#include "../visualization/vcontrolpointspline.h"
#include "../../libs/vpropertyexplorer/vproperties.h"
#include "vformulaproperty.h"
#include "../container/vformula.h"
#include "../core/vformula.h"
#include <QDockWidget>
#include <QHBoxLayout>

View File

@ -27,7 +27,6 @@
*************************************************************************/
#include "vabstractmeasurements.h"
#include "../core/vapplication.h"
const QString VAbstractMeasurements::TagUnit = QStringLiteral("unit");
const QString VAbstractMeasurements::AttrValue = QStringLiteral("value");
@ -201,77 +200,6 @@ Unit VAbstractMeasurements::MUnit() const
return VDomDocument::StrToUnits(unit);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VAbstractMeasurements::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) * VApplication::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) * VApplication::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 * VApplication::PrintDPI;
default:
break;
}
break;
case Unit::Px:
switch (to)
{
case Unit::Mm:
return (value / VApplication::PrintDPI) * 25.4;
case Unit::Cm:
return ((value / VApplication::PrintDPI) * 25.4) / 10.0;
case Unit::Inch:
return value / VApplication::PrintDPI;
case Unit::Px:
return value;
default:
break;
}
break;
default:
break;
}
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractMeasurements::Measurement(const QString &tag)
{

View File

@ -30,7 +30,7 @@
#define VABSTRACTMEASUREMENTS_H
#include "../libs/ifc/xml/vdomdocument.h"
#include "../container/vcontainer.h"
#include "../libs/vpatterndb/vcontainer.h"
class VAbstractMeasurements : public VDomDocument
{
@ -41,7 +41,6 @@ public:
Unit MUnit() const;
static const QString TagUnit;
static const QString AttrValue;
static qreal UnitConvertor(qreal value, const Unit &from, const Unit &to);
protected:
/** @brief data container with data. */
VContainer *data;

View File

@ -70,7 +70,8 @@ void VIndividualMeasurements::ReadMeasurement(const QDomElement &domElement, con
{
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
data->AddVariable(tag, new VMeasurement(tag, value, qApp->GuiText(tag), qApp->Description(tag), tag));
data->AddVariable(tag, new VMeasurement(tag, value, qApp->TrVars()->GuiText(tag),
qApp->TrVars()->Description(tag), tag));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -30,8 +30,8 @@
#define VPATTERN_H
#include "../libs/ifc/xml/vdomdocument.h"
#include "vtoolrecord.h"
#include "../container/vcontainer.h"
#include "../libs/ifc/xml/vtoolrecord.h"
#include "../libs/vpatterndb/vcontainer.h"
class VDataTool;
class VMainGraphicsScene;

View File

@ -64,7 +64,7 @@ QString VStandardMeasurements::OrigDescription ()
//---------------------------------------------------------------------------------------------------------------------
QString VStandardMeasurements::TrDescription()
{
const QString trDesc = qApp->STDescription(Id());
const QString trDesc = qApp->TrVars()->STDescription(Id());
if (trDesc.isEmpty() == false)
{
return trDesc;
@ -115,8 +115,8 @@ void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const
qWarning()<<"Standard table can't use inch unit.";
}
data->AddVariable(tag, new VMeasurement(tag, value, size_increase, height_increase, qApp->GuiText(tag),
qApp->Description(tag), tag));
data->AddVariable(tag, new VMeasurement(tag, value, size_increase, height_increase, qApp->TrVars()->GuiText(tag),
qApp->TrVars()->Description(tag), tag));
}

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