Loading measurements in Valentina.

This commit is contained in:
Roman Telezhynskyi 2020-10-15 18:05:21 +03:00
parent 23e6d0f830
commit 4cea74d63b
105 changed files with 1227 additions and 824 deletions

View File

@ -216,7 +216,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
{
if (topWinAllowsPop)
{
messageBox.setText(VAbstractApplication::ClearMessage(msg));
messageBox.setText(msg);
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.setWindowModality(Qt::ApplicationModal);
messageBox.setModal(true);

View File

@ -150,7 +150,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
const bool isPatternMessage = qApp->IsPatternMessage(msg);
if (isPatternMessage)
{
logMsg = logMsg.remove(VAbstractApplication::patternMessageSignature);
logMsg = logMsg.remove(VAbstractValApplication::patternMessageSignature);
}
{
@ -249,7 +249,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
break;
}
messageBox.setText(VAbstractApplication::ClearMessage(logMsg));
messageBox.setText(VAbstractValApplication::ClearMessage(logMsg));
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.setWindowModality(Qt::ApplicationModal);
messageBox.setModal(true);
@ -287,7 +287,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
* @param argv command line.
*/
VApplication::VApplication(int &argc, char **argv)
: VAbstractApplication(argc, argv),
: VAbstractValApplication(argc, argv),
trVars(nullptr),
autoSaveTimer(nullptr),
lockLog(),

View File

@ -29,11 +29,12 @@
#ifndef VAPPLICATION_H
#define VAPPLICATION_H
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "../vpatterndb/vtranslatevars.h"
#include "vsettings.h"
#include "vcmdexport.h"
#include "vlockguard.h"
class VApplication;// use in define
@ -45,7 +46,7 @@ class VApplication;// use in define
/**
* @brief The VApplication class reimplamentation QApplication class.
*/
class VApplication : public VAbstractApplication
class VApplication : public VAbstractValApplication
{
Q_OBJECT
public:
@ -114,7 +115,5 @@ inline void VApplication::setAutoSaveTimer(QTimer *value)
{
autoSaveTimer = value;
}
//---------------------------------------------------------------------------------------------------------------------
#endif // VAPPLICATION_H

View File

@ -2318,7 +2318,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
VFormula length1(spl.GetC1LengthFormula(), i->getData());
length1.setCheckZero(false);
length1.setToolId(i->getId());
length1.setPostfix(UnitsToStr(qApp->patternUnit()));
length1.setPostfix(UnitsToStr(qApp->patternUnits()));
length1.Eval();
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
@ -2332,7 +2332,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
VFormula length2(spl.GetC2LengthFormula(), i->getData());
length2.setCheckZero(false);
length2.setToolId(i->getId());
length2.setPostfix(UnitsToStr(qApp->patternUnit()));
length2.setPostfix(UnitsToStr(qApp->patternUnits()));
length2.Eval();
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
@ -3046,7 +3046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
length1F.setCheckZero(false);
length1F.setToolId(i->getId());
length1F.setPostfix(UnitsToStr(qApp->patternUnit()));
length1F.setPostfix(UnitsToStr(qApp->patternUnits()));
length1F.Eval();
QVariant length1;
length1.setValue(length1F);
@ -3064,7 +3064,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
length2F.setCheckZero(false);
length2F.setToolId(i->getId());
length2F.setPostfix(UnitsToStr(qApp->patternUnit()));
length2F.setPostfix(UnitsToStr(qApp->patternUnits()));
length2F.Eval();
QVariant length2;
length2.setValue(length2F);

View File

@ -373,7 +373,7 @@ void DialogFinalMeasurements::SaveFormula()
{
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnit());
const QString postfix = UnitsToStr(qApp->patternUnits());
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}
@ -381,7 +381,7 @@ void DialogFinalMeasurements::SaveFormula()
if (text.isEmpty())
{
//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnit());
const QString postfix = UnitsToStr(qApp->patternUnits());
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
return;
}
@ -455,7 +455,7 @@ void DialogFinalMeasurements::Fx()
dialog->setWindowTitle(tr("Edit measurement"));
dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
qApp->Settings()->GetOsSeparator()));
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
const QString postfix = UnitsToStr(qApp->patternUnits(), true);
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
if (dialog->exec() == QDialog::Accepted)
@ -513,7 +513,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::ShowUnits()
{
const QString unit = UnitsToStr(qApp->patternUnit());
const QString unit = UnitsToStr(qApp->patternUnits());
{
// calculated value
@ -554,7 +554,7 @@ void DialogFinalMeasurements::AddCell(const QString &text, int row, int column,
//---------------------------------------------------------------------------------------------------------------------
bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromUser)
{
const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch)
if (formula.isEmpty())
{
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));

View File

@ -268,7 +268,7 @@ void DialogIncrements::FillAnglesCurves()
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowUnits()
{
const QString unit = UnitsToStr(qApp->patternUnit());
const QString unit = UnitsToStr(qApp->patternUnits());
ShowHeaderUnits(ui->tableWidgetIncrement, 1, unit);// calculated value
ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula
@ -361,7 +361,7 @@ QString DialogIncrements::ClearIncrementName(const QString &name) const
//---------------------------------------------------------------------------------------------------------------------
bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label)
{
const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch)
if (formula.isEmpty())
{
label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
@ -1228,7 +1228,7 @@ void DialogIncrements::SaveIncrFormula()
{
QTableWidgetItem *result = table->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnit());
const QString postfix = UnitsToStr(qApp->patternUnits());
labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}
@ -1236,7 +1236,7 @@ void DialogIncrements::SaveIncrFormula()
if (text.isEmpty())
{
//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnit());
const QString postfix = UnitsToStr(qApp->patternUnits());
labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
return;
}
@ -1374,7 +1374,7 @@ void DialogIncrements::Fx()
dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(plainTextEditFormula->toPlainText(),
qApp->Settings()->GetOsSeparator()));
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
const QString postfix = UnitsToStr(qApp->patternUnits(), true);
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
if (dialog->exec() == QDialog::Accepted)

View File

@ -71,7 +71,7 @@ DialogLayoutScale::~DialogLayoutScale()
void DialogLayoutScale::SetTiledMargins(QMarginsF margins)
{
// read Margins top, right, bottom, left
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit());
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits());
ui->doubleSpinBoxLeftField->setValue(margins.left());
ui->doubleSpinBoxTopField->setValue(margins.top());
@ -89,7 +89,7 @@ QMarginsF DialogLayoutScale::GetTiledMargins() const
ui->doubleSpinBoxBottomField->value()
);
return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm);
return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm);
}
//---------------------------------------------------------------------------------------------------------------------
@ -181,7 +181,7 @@ void DialogLayoutScale::VerticalScaleChanged(double d)
void DialogLayoutScale::ReadSettings()
{
VSettings *settings = qApp->ValentinaSettings();
const Unit unit = qApp->patternUnit();
const Unit unit = qApp->patternUnits();
// read Margins top, right, bottom, left
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
@ -201,7 +201,7 @@ void DialogLayoutScale::ReadSettings()
void DialogLayoutScale::WriteSettings() const
{
VSettings *settings = qApp->ValentinaSettings();
const Unit unit = qApp->patternUnit();
const Unit unit = qApp->patternUnits();
// write Margins top, right, bottom, left
QMarginsF margins = QMarginsF(

View File

@ -140,7 +140,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close);
ui->tabWidget->setCurrentIndex(0);
if (qApp->patternType() != MeasurementsType::Multisize)
if (qApp->GetMeasurementsType() != MeasurementsType::Multisize)
{
ui->tabWidget->setTabEnabled(1, false);
}
@ -198,7 +198,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
ui->lineEditPatternNumber->setText(doc->GetPatternNumber());
ui->lineEditCompanyName->setText(doc->GetCompanyName());
if (qApp->patternType() == MeasurementsType::Individual)
if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
{
ui->lineEditCustomerName->setText(qApp->GetCustomerName());
ui->lineEditCustomerName->setReadOnly(true);
@ -629,7 +629,7 @@ void DialogPatternProperties::SaveLabelData()
doc->SetPatternName(ui->lineEditPatternName->text());
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
doc->SetCompanyName(ui->lineEditCompanyName->text());
if (qApp->patternType() != MeasurementsType::Individual)
if (qApp->GetMeasurementsType() != MeasurementsType::Individual)
{
doc->SetCustomerName(ui->lineEditCustomerName->text());
}

View File

@ -676,7 +676,7 @@ void DialogSaveLayout::SetTiledExportMode(bool tiledExportMode)
void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
{
// read Margins top, right, bottom, left
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit());
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits());
ui->doubleSpinBoxLeftField->setValue(margins.left());
ui->doubleSpinBoxTopField->setValue(margins.top());
@ -694,7 +694,7 @@ QMarginsF DialogSaveLayout::GetTiledMargins() const
ui->doubleSpinBoxBottomField->value()
);
return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm);
return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm);
}
//---------------------------------------------------------------------------------------------------------------------
@ -892,7 +892,7 @@ void DialogSaveLayout::RemoveFormatFromList(LayoutExportFormats format)
void DialogSaveLayout::ReadSettings()
{
VSettings *settings = qApp->ValentinaSettings();
const Unit unit = qApp->patternUnit();
const Unit unit = qApp->patternUnits();
// read Margins top, right, bottom, left
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
@ -946,7 +946,7 @@ void DialogSaveLayout::WriteSettings() const
}
VSettings *settings = qApp->ValentinaSettings();
const Unit unit = qApp->patternUnit();
const Unit unit = qApp->patternUnits();
// write Margins top, right, bottom, left
QMarginsF margins = QMarginsF(

View File

@ -297,7 +297,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
catch (const VExceptionBadId &)
{
const QString errorMsg = tr("Cannot find piece by id '%1'").arg(id);
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
}

View File

@ -230,7 +230,7 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
}
else if (selectedAction == actionPreferences)
{
QScopedPointer<VContainer> fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitP(),
QScopedPointer<VContainer> fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitsP(),
VContainer::UniqueNamespace()));
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this));
dialog->SetName(doc->GetGroupName(id));

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,9 @@
#include "mainwindowsnogui.h"
#include "core/vcmdexport.h"
#include "../vmisc/vlockguard.h"
#include "../vformat/vdimensions.h"
#include <QDoubleSpinBox>
#include <QPointer>
namespace Ui
@ -51,7 +53,6 @@ class DialogFinalMeasurements;
class VWidgetGroups;
class VWidgetDetails;
class QToolButton;
class QDoubleSpinBox;
class QProgressBar;
class WatermarkWindow;
@ -208,8 +209,11 @@ private slots:
void OpenAt(QAction *where);
#endif //defined(Q_OS_MAC)
void ChangedSize(const QString &text);
void ChangedHeight(const QString &text);
void DimensionABaseChanged();
void DimensionBBaseChanged();
void DimensionCBaseChanged();
void GradationChanged();
void ShowProgress();
void ClearPatternMessages();
@ -267,12 +271,14 @@ private:
QLabel *rightGoToStage;
QTimer *autoSaveTimer;
bool guiEnabled;
QPointer<QComboBox> gradationHeights;
QPointer<QComboBox> gradationSizes;
QPointer<QLabel> gradationHeightsLabel;
QPointer<QLabel> gradationSizesLabel;
QPointer<QLabel> zoomScale;
QPointer<QDoubleSpinBox> doubleSpinBoxScale;
QPointer<QComboBox> dimensionA{nullptr};
QPointer<QComboBox> dimensionB{nullptr};
QPointer<QComboBox> dimensionC{nullptr};
QPointer<QLabel> dimensionALabel{nullptr};
QPointer<QLabel> dimensionBLabel{nullptr};
QPointer<QLabel> dimensionCLabel{nullptr};
QPointer<QLabel> zoomScale{nullptr};
QPointer<QDoubleSpinBox> doubleSpinBoxScale{nullptr};
VToolOptionsPropertyBrowser *toolOptions;
VWidgetGroups *groupsWidget;
VWidgetDetails *detailsWidget;
@ -285,8 +291,16 @@ private:
QList<QPointer<WatermarkWindow>> m_watermarkEditors{};
void SetDefaultHeight();
void SetDefaultSize();
int m_currentDimensionA{0};
int m_currentDimensionB{0};
int m_currentDimensionC{0};
QSharedPointer<VMeasurements> m{};
QTimer *m_gradation;
void InitDimensionControls();
void InitDimensionGradation(int index, const MeasurementDimension_p &dimension, QPointer<QComboBox> control);
void ToolBarOption();
void ToolBarStages();
@ -338,15 +352,12 @@ private:
void InitAutoSave();
bool PatternPieceName(QString &name);
QString CheckPathToMeasurements(const QString &patternPath, const QString &path);
QComboBox *SetGradationList(QLabel *label, const QStringList &list);
void ChangePP(int index, bool zoomBestFit = true);
/**
* @brief EndVisualization try show dialog after and working with tool visualization.
*/
void EndVisualization(bool click = false);
void ZoomFirstShow();
void UpdateHeightsList(const QStringList &list);
void UpdateSizesList(const QStringList &list);
void AddDocks();
void InitDocksContain();
@ -360,7 +371,7 @@ private:
void InitScenes();
bool LoadMeasurements(const QString &path);
bool UpdateMeasurements(const QString &path, int size, int height);
bool UpdateMeasurements(const QString &path, int baseA, int baseB, int baseC);
void ReopenFilesAfterCrash(QStringList &args);
bool DoExport(const VCommandLinePtr& expParams);
@ -393,6 +404,12 @@ private:
void OpenWatermark(const QString &path = QString());
void CleanWaterkmarkEditors();
void StoreMultisizeMDimensions();
void StoreIndividualMDimensions();
QVector<int> DimensionRestrictedValues(int index, const MeasurementDimension_p &dimension);
void SetDimensionBases();
};
#endif // MAINWINDOW_H

View File

@ -136,7 +136,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
listDetails(),
currentScene(nullptr),
tempSceneLayout(nullptr),
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP(), valentinaNamespace)),
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitsP(), valentinaNamespace)),
doc(nullptr),
papers(),
shadows(),
@ -155,7 +155,6 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
margins(),
paperSize(),
m_dialogSaveLayout(),
m_mouseCoordinate(),
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarButton(new QWinTaskbarButton(this)),
m_taskbarProgress(nullptr),
@ -930,7 +929,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
{
const QString errorMsg = tr("File error.\n\n%1\n\n%2").arg(e.ErrorMessage(), e.DetailedInformation());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
}
@ -2047,33 +2046,6 @@ QString MainWindowsNoGUI::FileName() const
return QFileInfo(fileName).baseName();
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::SetSizeHeightForIndividualM() const
{
const QHash<QString, QSharedPointer<VInternalVariable> > * vars = pattern->DataVariables();
if (vars->contains(size_M))
{
pattern->SetSize(*vars->value(size_M)->GetValue());
}
else
{
pattern->SetSize(0);
}
if (vars->contains(height_M))
{
pattern->SetHeight(*vars->value(height_M)->GetValue());
}
else
{
pattern->SetHeight(0);
}
doc->SetPatternWasChanged(true);
emit doc->UpdatePatternLabel();
}
//---------------------------------------------------------------------------------------------------------------------
bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib,
const QChar &separator) const

View File

@ -122,8 +122,8 @@ protected:
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout;
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
QPointer<QLabel> m_mouseCoordinate;
QPointer<QLabel> m_unreadPatternMessage{};
QPointer<QLabel> m_mouseCoordinate{nullptr};
QPointer<QLabel> m_unreadPatternMessage{nullptr};
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QWinTaskbarButton *m_taskbarButton;
@ -142,7 +142,6 @@ protected:
bool GenerateLayout(VLayoutGenerator& lGenerator);
int ContinueIfLayoutStale();
QString FileName() const;
void SetSizeHeightForIndividualM() const;
bool ExportFMeasurementsToCSVData(const QString &fileName,
bool withHeader, int mib, const QChar &separator) const;

View File

@ -127,7 +127,7 @@ void VPattern::CreateEmptyFile()
patternElement.appendChild(createComment(FileComment()));
patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr));
patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnit())));
patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnits())));
patternElement.appendChild(createElement(TagDescription));
patternElement.appendChild(createElement(TagNotes));

View File

@ -100,9 +100,11 @@ public:
bool IsDefCustom() const;
void SetDefCustom(bool value);
// TODO: remove
int GetDefCustomHeight() const;
void SetDefCustomHeight(int value);
// TODO: remove
int GetDefCustomSize() const;
void SetDefCustomSize(int value);

View File

@ -48,7 +48,7 @@
#include "../ifc/exception/vexception.h"
#include "../ifc/xml/vabstractconverter.h"
#include "../vmisc/projectversion.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vcommonsettings.h"
#include "fvavailableupdate.h"
#include "fvupdatewindow.h"

View File

@ -54,7 +54,7 @@
#include "vpatternconverter.h"
#include "vdomdocument.h"
#include "vtoolrecord.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../vlayout/vtextmanager.h"

View File

@ -4,8 +4,9 @@
#include <algorithm>
#include <QString>
#include <QTextCodec>
#include <QDebug>
#include "../drw_base.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../ifc/exception/vexception.h"
namespace
@ -112,7 +113,7 @@ void DRW_TextCodec::setCodePage(const std::string *c, bool dxfFormat){
const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.")
.arg(cp.c_str());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
if (version < DRW::AC1021 && cp == "UTF-8")
{

View File

@ -89,7 +89,7 @@ public:
void SetBirthDate(const QDate &date);
GenderType Gender() const;
void SetGender(const GenderType &gender);
void SetGender(const GenderType &gender);
QString PMSystem() const;
void SetPMSystem(const QString &system);

View File

@ -118,7 +118,7 @@ QDomElement VPatternRecipe::Prerequisite()
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), APP_VERSION_STR));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnit())));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnits())));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription()));
@ -437,7 +437,7 @@ QDomElement VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm)
tr("Value for final measurtement '%1' is infinite or NaN. "
"Please, check your calculations.").arg(fm.name));
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);

View File

@ -36,7 +36,7 @@
#include <QtDebug>
#include "vabstractcurve_p.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../ifc/exception/vexceptionobjecterror.h"
@ -146,7 +146,7 @@ QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QP
.arg(piece, name(), error);
}
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
return segment;

View File

@ -31,7 +31,7 @@
#include <QSharedData>
#include "vgeometrydef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/diagnostic.h"
QT_WARNING_PUSH

View File

@ -2,7 +2,7 @@
#define VELLIPTICALARC_P
#include <QSharedData>
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/diagnostic.h"
#include "vpointf.h"

View File

@ -33,7 +33,7 @@
#include <QLineF>
#include "vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vmath.h"
QT_WARNING_PUSH

View File

@ -28,7 +28,7 @@
#include "vabstractpiece.h"
#include "vabstractpiece_p.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vgeometry/vpointf.h"
#include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
@ -1072,7 +1072,7 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
{
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QVector<QPointF>();
}

View File

@ -32,7 +32,7 @@
#include <QLoggingCategory>
#include "../vmisc/diagnostic.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "vlayoutdef.h"
#include "../ifc/exception/vexception.h"
@ -335,7 +335,7 @@ bool VBank::PrepareUnsorted()
const qint64 square = details.at(i).Square();
if (square <= 0)
{
qCCritical(lBank) << VAbstractApplication::patternMessageSignature +
qCCritical(lBank) << VAbstractValApplication::patternMessageSignature +
tr("Preparing data for layout error: Detail '%1' square <= 0")
.arg(details.at(i).GetName());
prepare = false;
@ -360,7 +360,7 @@ bool VBank::PrepareDetails()
{
if (layoutWidth <= 0)
{
qCCritical(lBank) << VAbstractApplication::patternMessageSignature +
qCCritical(lBank) << VAbstractValApplication::patternMessageSignature +
tr("Preparing data for layout error: Layout paper sheet <= 0");
prepare = false;
return prepare;
@ -368,7 +368,7 @@ bool VBank::PrepareDetails()
if (details.isEmpty())
{
qCCritical(lBank) << VAbstractApplication::patternMessageSignature +
qCCritical(lBank) << VAbstractValApplication::patternMessageSignature +
tr("Preparing data for layout error: List of details is empty");
prepare = false;
return prepare;
@ -391,7 +391,7 @@ bool VBank::PrepareDetails()
const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance"
" to check how seam allowance behave.").arg(details.at(i).GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
const qreal d = details.at(i).Diagonal();

View File

@ -48,7 +48,7 @@
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vmisc/vmath.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/calculator.h"
@ -269,7 +269,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
.arg(pData.nodeName, piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return;
}
@ -283,7 +283,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
"empty.")
.arg(pData.nodeName, piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return;
}
layoutPassmark.baseLine = ConstFirst (baseLines);
@ -300,7 +300,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
QObject::tr("Passmark '%1' is not part of piece '%2'.")
.arg(pData.nodeName, piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
};
@ -326,7 +326,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
.arg(pData.nodeName, piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return;
}
@ -346,7 +346,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
.arg(pData.nodeName, piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return;
}
@ -362,7 +362,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
QObject::tr("Passmark '%1' is not part of piece '%2'.")
.arg(pData.nodeName, piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
};
@ -508,7 +508,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
.arg(piece.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
det.SetCountourPoints(futureMainPath.result(),

View File

@ -43,10 +43,11 @@
#include <QImageReader>
#include <QPixmapCache>
#include <QPainter>
#include <QFileInfo>
#include "../vmisc/vmath.h"
#include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../ifc/exception/vexception.h"
namespace
@ -309,7 +310,7 @@ QVector<QGraphicsItem *> VPoster::ImageWatermark(QGraphicsItem *parent, const Po
{
const QString errorMsg = tr("Cannot open the watermark image.") + QChar(' ') + error;
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return data;
}
@ -319,7 +320,7 @@ QVector<QGraphicsItem *> VPoster::ImageWatermark(QGraphicsItem *parent, const Po
{
const QString errorMsg = tr("Not supported file suffix '%1'").arg(f.suffix());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return data;
}
@ -455,7 +456,7 @@ void VPoster::Ruler(QVector<QGraphicsItem *> &data, QGraphicsItem *parent, QRect
const qreal notchHeight = ToPixel(3); // mm
const qreal shortNotchHeight = ToPixel(1.1); // mm
Unit patternUnits = qApp->patternUnit();
Unit patternUnits = qApp->patternUnits();
const qreal step = UnitConvertor(1, patternUnits, Unit::Px);
double marksCount = rec.width() / step;
int i = 0;

View File

@ -37,7 +37,7 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vmath.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h"
@ -185,7 +185,7 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
placeholders.insert(pl_author, doc->GetCompanyName());
if (qApp->patternType() == MeasurementsType::Individual)
if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
{
placeholders.insert(pl_customer, qApp->GetCustomerName());
}
@ -201,13 +201,13 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
QString curSize;
QString curHeight;
QString mExt;
if (qApp->patternType() == MeasurementsType::Multisize)
if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
{
curSize = QString::number(VContainer::size(valentinaNamespace));
curHeight = QString::number(VContainer::height(valentinaNamespace));
mExt = QStringLiteral("vst");
}
else if (qApp->patternType() == MeasurementsType::Individual)
else if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
{
curSize = QString::number(VContainer::size(valentinaNamespace));
curHeight = QString::number(VContainer::height(valentinaNamespace));

View File

@ -82,7 +82,7 @@ extern const int maxLabelFontSize;
enum class NodeDetail : qint8 { Contour, Modeling };
enum class SceneObject : qint8 { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
enum class MeasurementsType : qint8 { Multisize, Individual , Unknown};
enum class MeasurementsType : qint8 { Multisize, Individual, Unknown};
enum class Unit : qint8 { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE};
enum class Source : qint8 { FromGui, FromFile, FromTool };
enum class NodeUsage : bool {NotInUse = false, InUse = true};

View File

@ -36,6 +36,7 @@
#include <QPushButton>
#include <QShowEvent>
#include <QTextCodec>
#include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
DialogExportToCSV::DialogExportToCSV(QWidget *parent)

View File

@ -31,6 +31,7 @@
#include "vabstractapplication.h"
#include "projectversion.h"
#include "../vmisc/vsettings.h"
#if defined(qApp)
#undef qApp

View File

@ -42,9 +42,6 @@
#include <QWidget>
#include <QStandardPaths>
#include "../vmisc/def.h"
#include "../vmisc/customevents.h"
#ifdef Q_OS_UNIX
# include <unistd.h>
#endif
@ -53,29 +50,10 @@
# include "appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
//---------------------------------------------------------------------------------------------------------------------
VAbstractApplication::VAbstractApplication(int &argc, char **argv)
:QApplication(argc, argv),
undoStack(new QUndoStack(this)),
mainWindow(nullptr),
settings(nullptr),
qtTranslator(nullptr),
qtxmlTranslator(nullptr),
qtBaseTranslator(nullptr),
appTranslator(nullptr),
pmsTranslator(nullptr),
_patternUnit(Unit::Cm),
_patternType(MeasurementsType::Unknown),
patternFilePath(),
currentScene(nullptr),
sceneView(nullptr),
doc(nullptr),
m_customerName(),
m_userMaterials(),
openingPattern(false),
mode(Draw::Calculation)
undoStack(new QUndoStack(this))
{
QString rules;
@ -121,10 +99,6 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
connect(this, &QApplication::aboutToQuit, this, &VAbstractApplication::AboutToQuit);
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractApplication::~VAbstractApplication()
{}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief translationsPath return path to the root directory that contain QM files.
@ -189,56 +163,6 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
#endif
}
//---------------------------------------------------------------------------------------------------------------------
MeasurementsType VAbstractApplication::patternType() const
{
return _patternType;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setPatternType(const MeasurementsType &patternType)
{
_patternType = patternType;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setCurrentDocument(VAbstractPattern *doc)
{
this->doc = doc;
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractPattern *VAbstractApplication::getCurrentDocument() const
{
SCASSERT(doc != nullptr)
return doc;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractApplication::getOpeningPattern() const
{
return openingPattern;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setOpeningPattern()
{
openingPattern = !openingPattern;
}
//---------------------------------------------------------------------------------------------------------------------
QWidget *VAbstractApplication::getMainWindow() const
{
return mainWindow;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setMainWindow(QWidget *value)
{
SCASSERT(value != nullptr)
mainWindow = value;
}
//---------------------------------------------------------------------------------------------------------------------
QUndoStack *VAbstractApplication::getUndoStack() const
{
@ -251,47 +175,6 @@ bool VAbstractApplication::IsPedantic() const
return false;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClearMessage helps to clear a message string from standard Qt function.
* @param msg the message that contains '"' at the start and at the end
* @return cleared string
*/
QString VAbstractApplication::ClearMessage(QString msg)
{
if (msg.startsWith('"') && msg.endsWith('"'))
{
msg.remove(0, 1);
msg.chop(1);
}
return msg;
}
//---------------------------------------------------------------------------------------------------------------------
const Draw &VAbstractApplication::GetDrawMode() const
{
return mode;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::SetDrawMode(const Draw &value)
{
mode = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::PostPatternMessage(const QString &message, QtMsgType severity) const
{
QApplication::postEvent(mainWindow, new PatternMessageEvent(VAbstractApplication::ClearMessage(message), severity));
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractApplication::IsPatternMessage(const QString &message) const
{
return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature);
}
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_OS_WIN)
void VAbstractApplication::WinAttachConsole()
@ -312,24 +195,6 @@ void VAbstractApplication::WinAttachConsole()
}
#endif
//---------------------------------------------------------------------------------------------------------------------
Unit VAbstractApplication::patternUnit() const
{
return _patternUnit;
}
//---------------------------------------------------------------------------------------------------------------------
const Unit *VAbstractApplication::patternUnitP() const
{
return &_patternUnit;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setPatternUnit(const Unit &patternUnit)
{
_patternUnit = patternUnit;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getSettings hide settings constructor.
@ -341,43 +206,6 @@ VCommonSettings *VAbstractApplication::Settings()
return settings;
}
//---------------------------------------------------------------------------------------------------------------------
QGraphicsScene *VAbstractApplication::getCurrentScene() const
{
SCASSERT(*currentScene != nullptr)
return *currentScene;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setCurrentScene(QGraphicsScene **value)
{
currentScene = value;
}
//---------------------------------------------------------------------------------------------------------------------
VMainGraphicsView *VAbstractApplication::getSceneView() const
{
return sceneView;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::setSceneView(VMainGraphicsView *value)
{
sceneView = value;
}
//---------------------------------------------------------------------------------------------------------------------
double VAbstractApplication::toPixel(double val) const
{
return ToPixel(val, _patternUnit);
}
//---------------------------------------------------------------------------------------------------------------------
double VAbstractApplication::fromPixel(double pix) const
{
return FromPixel(pix, _patternUnit);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::LoadTranslation(const QString &locale)
{

View File

@ -32,25 +32,21 @@
#include <qcompilerdetection.h>
#include <QApplication>
#include <QCoreApplication>
#include <QGraphicsScene>
#include <QLocale>
#include <QMetaObject>
#include <QObject>
#include <QPointer>
#include <QString>
#include <QtGlobal>
#include <QTranslator>
#include "../vmisc/def.h"
#include "../vpatterndb/vtranslatevars.h"
#include "def.h"
#include "vcommonsettings.h"
#include "vlockguard.h"
#include "vsettings.h"
class QUndoStack;
class VAbstractApplication;// use in define
class VAbstractPattern;
class VMainGraphicsView;
class VCommonSettings;
#if defined(qApp)
#undef qApp
@ -62,92 +58,42 @@ class VAbstractApplication : public QApplication
Q_OBJECT
public:
VAbstractApplication(int &argc, char ** argv);
virtual ~VAbstractApplication() override;
virtual ~VAbstractApplication() =default;
virtual const VTranslateVars *TrVars()=0;
QString translationsPath(const QString &locale = QString()) const;
QString translationsPath(const QString &locale = QString()) const;
void LoadTranslation(const QString &locale);
Unit patternUnit() const;
const Unit *patternUnitP() const;
void setPatternUnit(const Unit &patternUnit);
MeasurementsType patternType() const;
void setPatternType(const MeasurementsType &patternType);
QString GetCustomerName() const;
void SetCustomerName(const QString &name);
void LoadTranslation(const QString &locale);
virtual void OpenSettings()=0;
VCommonSettings *Settings();
template <typename T>
QString LocaleToString(const T &value);
QString LocaleToString(const T &value);
QGraphicsScene *getCurrentScene() const;
void setCurrentScene(QGraphicsScene **value);
QUndoStack *getUndoStack() const;
VMainGraphicsView *getSceneView() const;
void setSceneView(VMainGraphicsView *value);
double toPixel(double val) const;
double fromPixel(double pix) const;
void setCurrentDocument(VAbstractPattern *doc);
VAbstractPattern *getCurrentDocument()const;
bool getOpeningPattern() const;
void setOpeningPattern();
QWidget *getMainWindow() const;
void setMainWindow(QWidget *value);
QUndoStack *getUndoStack() const;
virtual bool IsAppInGUIMode()const =0;
virtual bool IsPedantic() const;
QString GetPatternPath() const;
void SetPatternPath(const QString &value);
virtual bool IsAppInGUIMode()const =0;
virtual bool IsPedantic() const;
#if defined(Q_OS_WIN)
static void WinAttachConsole();
#endif
static QString ClearMessage(QString msg);
QMap<int, QString> GetUserMaterials() const;
void SetUserMaterials(const QMap<int, QString> &userMaterials);
const Draw &GetDrawMode() const;
void SetDrawMode(const Draw &value);
void PostPatternMessage(const QString &message, QtMsgType severity) const;
static const QString patternMessageSignature;
bool IsPatternMessage(const QString &message) const;
protected:
QUndoStack *undoStack;
/**
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
* modality doesn't work.
*/
QWidget *mainWindow;
QUndoStack *undoStack;
/**
* @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable.
*/
VCommonSettings *settings;
VCommonSettings *settings{nullptr};
QPointer<QTranslator> qtTranslator;
QPointer<QTranslator> qtxmlTranslator;
QPointer<QTranslator> qtBaseTranslator;
QPointer<QTranslator> appTranslator;
QPointer<QTranslator> pmsTranslator;
QPointer<QTranslator> qtTranslator{nullptr};
QPointer<QTranslator> qtxmlTranslator{nullptr};
QPointer<QTranslator> qtBaseTranslator{nullptr};
QPointer<QTranslator> appTranslator{nullptr};
QPointer<QTranslator> pmsTranslator{nullptr};
virtual void InitTrVars()=0;
@ -156,66 +102,10 @@ protected slots:
private:
Q_DISABLE_COPY(VAbstractApplication)
Unit _patternUnit;
MeasurementsType _patternType;
QString patternFilePath;
QGraphicsScene **currentScene;
VMainGraphicsView *sceneView;
VAbstractPattern *doc;
QString m_customerName;
QMap<int, QString> m_userMaterials;
/**
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
* we can allow user use Undo option.
*/
bool openingPattern;
/** @brief mode keep current draw mode. */
Draw mode;
void ClearTranslation();
};
//---------------------------------------------------------------------------------------------------------------------
inline QString VAbstractApplication::GetCustomerName() const
{
return m_customerName;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractApplication::SetCustomerName(const QString &name)
{
m_customerName = name;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VAbstractApplication::GetPatternPath() const
{
return patternFilePath;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractApplication::SetPatternPath(const QString &value)
{
patternFilePath = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline QMap<int, QString> VAbstractApplication::GetUserMaterials() const
{
return m_userMaterials;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractApplication::SetUserMaterials(const QMap<int, QString> &userMaterials)
{
m_userMaterials = userMaterials;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline QString VAbstractApplication::LocaleToString(const T &value)

View File

@ -0,0 +1,80 @@
/************************************************************************
**
** @file vabstractvalapplication.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 10, 2020
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2020 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "vabstractvalapplication.h"
#include "../vmisc/customevents.h"
#include <QWidget>
const QString VAbstractValApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
//---------------------------------------------------------------------------------------------------------------------
VAbstractValApplication::VAbstractValApplication(int &argc, char **argv)
: VAbstractApplication(argc, argv)
{}
//---------------------------------------------------------------------------------------------------------------------
double VAbstractValApplication::toPixel(double val) const
{
return ToPixel(val, m_patternUnits);
}
//---------------------------------------------------------------------------------------------------------------------
double VAbstractValApplication::fromPixel(double pix) const
{
return FromPixel(pix, m_patternUnits);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractValApplication::PostPatternMessage(const QString &message, QtMsgType severity) const
{
QApplication::postEvent(mainWindow,
new PatternMessageEvent(VAbstractValApplication::ClearMessage(message), severity));
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClearMessage helps to clear a message string from standard Qt function.
* @param msg the message that contains '"' at the start and at the end
* @return cleared string
*/
QString VAbstractValApplication::ClearMessage(QString msg)
{
if (msg.startsWith('"') && msg.endsWith('"'))
{
msg.remove(0, 1);
msg.chop(1);
}
return msg;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractValApplication::IsPatternMessage(const QString &message) const
{
return VAbstractValApplication::ClearMessage(message).startsWith(patternMessageSignature);
}

View File

@ -0,0 +1,394 @@
/************************************************************************
**
** @file vabstractvalapplication.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 10, 2020
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2020 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VABSTRACTVALAPPLICATION_H
#define VABSTRACTVALAPPLICATION_H
#include "vabstractapplication.h"
#include <QDate>
class VAbstractValApplication;// use in define
class VAbstractPattern;
class VMainGraphicsView;
class QGraphicsScene;
#if defined(qApp)
#undef qApp
#endif
#define qApp (static_cast<VAbstractValApplication*>(QCoreApplication::instance()))
class VAbstractValApplication : public VAbstractApplication
{
Q_OBJECT
public:
VAbstractValApplication(int &argc, char **argv);
virtual ~VAbstractValApplication() =default;
QString GetCustomerName() const;
void SetCustomerName(const QString &name);
QDate GetCustomerBirthDate() const;
void SetCustomerBirthDate(const QDate &date);
QString CustomerEmail() const;
void SetCustomerEmail(const QString &email);
Unit patternUnits() const;
const Unit *patternUnitsP() const;
void SetPatternUnits(const Unit &patternUnit);
MeasurementsType GetMeasurementsType() const;
void SetMeasurementsType(const MeasurementsType &patternType);
Unit MeasurementsUnits() const;
void SetMeasurementsUnits(const Unit &measurementsUnits);
Unit DimensionSizeUnits() const;
void SetDimensionSizeUnits(const Unit &sizeUnits);
double toPixel(double val) const;
double fromPixel(double pix) const;
void setCurrentDocument(VAbstractPattern *doc);
VAbstractPattern *getCurrentDocument() const;
VMainGraphicsView *getSceneView() const;
void setSceneView(VMainGraphicsView *value);
QGraphicsScene *getCurrentScene() const;
void setCurrentScene(QGraphicsScene **value);
QWidget *getMainWindow() const;
void setMainWindow(QWidget *value);
QString GetPatternPath() const;
void SetPatternPath(const QString &value);
QMap<int, QString> GetUserMaterials() const;
void SetUserMaterials(const QMap<int, QString> &userMaterials);
const Draw &GetDrawMode() const;
void SetDrawMode(const Draw &value);
bool getOpeningPattern() const;
void setOpeningPattern();
void PostPatternMessage(const QString &message, QtMsgType severity) const;
static QString ClearMessage(QString msg);
static const QString patternMessageSignature;
bool IsPatternMessage(const QString &message) const;
qreal GetDimensionHeight() const;
void SetDimensionHeight(qreal dimensionHeight);
qreal GetDimensionSize() const;
void SetDimensionSize(qreal dimensionSize);
qreal GetDimensionHip() const;
void SetDimensionHip(qreal dimensionHip);
qreal GetDimensionWaist() const;
void SetDimensionWaist(qreal dimensionWaist);
protected:
QString m_customerName{};
QDate m_customerBirthDate{};
QString m_customerEmail{};
Unit m_patternUnits{Unit::Cm};
MeasurementsType m_measurementsType{MeasurementsType::Unknown};
Unit m_measurementsUnits{Unit::Cm};
VAbstractPattern *m_doc{nullptr};
VMainGraphicsView *m_sceneView{nullptr};
QGraphicsScene **m_currentScene{nullptr};
QString m_patternFilePath{};
QMap<int, QString> m_userMaterials{};
qreal m_dimensionHeight{0};
qreal m_dimensionSize{0};
qreal m_dimensionHip{0};
qreal m_dimensionWaist{0};
Unit m_dimensionSizeUnits{Unit::Cm};
/**
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
* modality doesn't work.
*/
QWidget *mainWindow{nullptr};
/** @brief mode keep current draw mode. */
Draw m_mode{Draw::Calculation};
/**
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
* we can allow user use Undo option.
*/
bool openingPattern{false};
private:
Q_DISABLE_COPY(VAbstractValApplication)
};
//---------------------------------------------------------------------------------------------------------------------
inline QString VAbstractValApplication::GetCustomerName() const
{
return m_customerName;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetCustomerName(const QString &name)
{
m_customerName = name;
}
//---------------------------------------------------------------------------------------------------------------------
inline Unit VAbstractValApplication::patternUnits() const
{
return m_patternUnits;
}
//---------------------------------------------------------------------------------------------------------------------
inline const Unit *VAbstractValApplication::patternUnitsP() const
{
return &m_patternUnits;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetPatternUnits(const Unit &patternUnit)
{
m_patternUnits = patternUnit;
}
//---------------------------------------------------------------------------------------------------------------------
inline MeasurementsType VAbstractValApplication::GetMeasurementsType() const
{
return m_measurementsType;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetMeasurementsType(const MeasurementsType &patternType)
{
m_measurementsType = patternType;
}
//---------------------------------------------------------------------------------------------------------------------
inline Unit VAbstractValApplication::MeasurementsUnits() const
{
return m_measurementsUnits;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetMeasurementsUnits(const Unit &measurementsUnits)
{
m_measurementsUnits = measurementsUnits;
}
//---------------------------------------------------------------------------------------------------------------------
inline Unit VAbstractValApplication::DimensionSizeUnits() const
{
return m_dimensionSizeUnits;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetDimensionSizeUnits(const Unit &sizeUnits)
{
m_dimensionSizeUnits = sizeUnits;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::setCurrentDocument(VAbstractPattern *doc)
{
m_doc = doc;
}
//---------------------------------------------------------------------------------------------------------------------
inline VAbstractPattern *VAbstractValApplication::getCurrentDocument() const
{
return m_doc;
}
//---------------------------------------------------------------------------------------------------------------------
inline VMainGraphicsView *VAbstractValApplication::getSceneView() const
{
return m_sceneView;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::setSceneView(VMainGraphicsView *value)
{
m_sceneView = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline QGraphicsScene *VAbstractValApplication::getCurrentScene() const
{
return *m_currentScene;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::setCurrentScene(QGraphicsScene **value)
{
m_currentScene = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline QWidget *VAbstractValApplication::getMainWindow() const
{
return mainWindow;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::setMainWindow(QWidget *value)
{
mainWindow = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VAbstractValApplication::GetPatternPath() const
{
return m_patternFilePath;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetPatternPath(const QString &value)
{
m_patternFilePath = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline QMap<int, QString> VAbstractValApplication::GetUserMaterials() const
{
return m_userMaterials;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetUserMaterials(const QMap<int, QString> &userMaterials)
{
m_userMaterials = userMaterials;
}
//---------------------------------------------------------------------------------------------------------------------
inline const Draw &VAbstractValApplication::GetDrawMode() const
{
return m_mode;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetDrawMode(const Draw &value)
{
m_mode = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline bool VAbstractValApplication::getOpeningPattern() const
{
return openingPattern;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::setOpeningPattern()
{
openingPattern = !openingPattern;
}
//---------------------------------------------------------------------------------------------------------------------
inline qreal VAbstractValApplication::GetDimensionHeight() const
{
return m_dimensionHeight;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetDimensionHeight(qreal dimensionHeight)
{
m_dimensionHeight = dimensionHeight;
}
//---------------------------------------------------------------------------------------------------------------------
inline qreal VAbstractValApplication::GetDimensionSize() const
{
return m_dimensionSize;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetDimensionSize(qreal dimensionSize)
{
m_dimensionSize = dimensionSize;
}
//---------------------------------------------------------------------------------------------------------------------
inline qreal VAbstractValApplication::GetDimensionHip() const
{
return m_dimensionHip;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetDimensionHip(qreal dimensionHip)
{
m_dimensionHip = dimensionHip;
}
//---------------------------------------------------------------------------------------------------------------------
inline qreal VAbstractValApplication::GetDimensionWaist() const
{
return m_dimensionWaist;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetDimensionWaist(qreal dimensionWaist)
{
m_dimensionWaist = dimensionWaist;
}
//---------------------------------------------------------------------------------------------------------------------
inline QDate VAbstractValApplication::GetCustomerBirthDate() const
{
return m_customerBirthDate;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetCustomerBirthDate(const QDate &date)
{
m_customerBirthDate = date;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VAbstractValApplication::CustomerEmail() const
{
return m_customerEmail;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VAbstractValApplication::SetCustomerEmail(const QString &email)
{
m_customerEmail = email;
}
#endif // VABSTRACTVALAPPLICATION_H

View File

@ -3,6 +3,7 @@
SOURCES += \
$$PWD/def.cpp \
$$PWD/vabstractvalapplication.cpp \
$$PWD/vsettings.cpp \
$$PWD/vabstractapplication.cpp \
$$PWD/projectversion.cpp \
@ -27,6 +28,7 @@ HEADERS += \
$$PWD/compatibility.h \
$$PWD/stable.h \
$$PWD/def.h \
$$PWD/vabstractvalapplication.h \
$$PWD/vmath.h \
$$PWD/vsettings.h \
$$PWD/vabstractapplication.h \

View File

@ -116,6 +116,7 @@ public:
QMap<QString, qreal> GetCorrections() const;
void SetCorrections(const QMap<QString, qreal> &corrections);
// TODO: remove
static QStringList ListHeights(const QMap<GHeights, bool> &heights, Unit patternUnit);
static QStringList ListSizes(const QMap<GSizes, bool> &sizes, Unit patternUnit);
static QStringList WholeListHeights(Unit patternUnit);

View File

@ -29,7 +29,7 @@
#include <QPainterPath>
#include "vpassmark.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../ifc/exception/vexceptioninvalidnotch.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/varc.h"
@ -579,7 +579,7 @@ QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const
"than minimal allowed.")
.arg(passmarkData.nodeName, passmarkData.pieceName);
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QVector<QLineF>();
}
@ -788,7 +788,7 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
"than minimal allowed.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QVector<QLineF>();
}
}
@ -804,7 +804,7 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
"seam allowance. User must manually provide length.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QVector<QLineF>();
}
}
@ -848,7 +848,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
"empty.").arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QVector<QLineF>(); // Something wrong
}
@ -860,7 +860,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
"position for a notch.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QVector<QLineF>(); // Something wrong
}
@ -870,7 +870,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
"notch position.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width)
@ -892,7 +892,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
"less than minimal allowed.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return QLineF();
}
line.setLength(length);
@ -909,7 +909,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
"collapse.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
}
else
@ -918,7 +918,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
"intersection.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
return QLineF();
@ -933,7 +933,7 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
"than minimal allowed.")
.arg(m_data.nodeName, m_data.pieceName);
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
else
{

View File

@ -34,7 +34,7 @@
#include "../vgeometry/vplacelabelitem.h"
#include "../vgeometry/varc.h"
#include "vcontainer.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../ifc/exception/vexceptioninvalidnotch.h"
#include "../vlayout/testpath.h"
@ -937,7 +937,7 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int in
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return false; // Something wrong
}
@ -976,7 +976,7 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index,
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return false; // Something wrong
}
@ -1060,7 +1060,7 @@ VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIn
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return VPassmark();
}
@ -1089,7 +1089,7 @@ VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIn
const QString infoMsg = tr("Notch for point '%1' in piece '%2' will be disabled. Manual length is less than "
"allowed value.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
qInfo() << VAbstractApplication::patternMessageSignature + infoMsg;
qInfo() << VAbstractValApplication::patternMessageSignature + infoMsg;
return VPassmark();
}

View File

@ -31,7 +31,7 @@
#include "vcontainer.h"
#include "calculator.h"
#include "vformula.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include <QDataStream>
#include <QtNumeric>
@ -162,7 +162,7 @@ qreal VPieceNode::GetSABefore(const VContainer *data) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return -1;
}
return formula.getDoubleValue();
@ -193,7 +193,7 @@ qreal VPieceNode::GetSABefore(const VContainer *data, Unit unit) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return -1;
}
@ -245,7 +245,7 @@ qreal VPieceNode::GetSAAfter(const VContainer *data) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return -1;
}
@ -277,7 +277,7 @@ qreal VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ")
.arg(nodeName, formula.Reason());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return -1;
}
@ -343,7 +343,7 @@ qreal VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
return VSAPoint::maxPassmarkLength;
}

View File

@ -32,7 +32,7 @@
#include "../vgeometry/vpointf.h"
#include "../vlayout/vabstractpiece.h"
#include "calculator.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/compatibility.h"
#include "../ifc/exception/vexceptionobjecterror.h"
@ -385,7 +385,7 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QP
"point with cutting countour")
.arg(GetName());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
}
@ -402,7 +402,7 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QP
"point with cutting countour")
.arg(GetName());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
}

View File

@ -500,7 +500,7 @@ void DialogEditLabel::InitPlaceholders()
m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber()));
m_placeholders.insert(pl_author, qMakePair(tr("Company name or designer name"), m_doc->GetCompanyName()));
if (qApp->patternType() == MeasurementsType::Individual)
if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
{
m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), qApp->GetCustomerName()));
}
@ -520,13 +520,13 @@ void DialogEditLabel::InitPlaceholders()
QString curSize;
QString curHeight;
QString mExt;
if (qApp->patternType() == MeasurementsType::Multisize)
if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
{
curSize = QString::number(VContainer::size(valentinaNamespace));
curHeight = QString::number(VContainer::height(valentinaNamespace));
mExt = "vst";
}
else if (qApp->patternType() == MeasurementsType::Individual)
else if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
{
curSize = QString::number(VContainer::size(valentinaNamespace));
curHeight = QString::number(VContainer::height(valentinaNamespace));
@ -553,20 +553,20 @@ void DialogEditLabel::InitPlaceholders()
}
// Piece tags
m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString(QString())));
m_placeholders.insert(pl_pAnnotation, qMakePair(tr("Piece annotation"), QString(QString())));
m_placeholders.insert(pl_pOrientation, qMakePair(tr("Piece orientation"), QString(QString())));
m_placeholders.insert(pl_pRotation, qMakePair(tr("Piece rotation"), QString(QString())));
m_placeholders.insert(pl_pTilt, qMakePair(tr("Piece tilt"), QString(QString())));
m_placeholders.insert(pl_pFoldPosition, qMakePair(tr("Piece fold position"), QString(QString())));
m_placeholders.insert(pl_pName, qMakePair(tr("Piece name"), QString(QString())));
m_placeholders.insert(pl_pQuantity, qMakePair(tr("Quantity"), QString(QString())));
m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString()));
m_placeholders.insert(pl_pAnnotation, qMakePair(tr("Piece annotation"), QString()));
m_placeholders.insert(pl_pOrientation, qMakePair(tr("Piece orientation"), QString()));
m_placeholders.insert(pl_pRotation, qMakePair(tr("Piece rotation"), QString()));
m_placeholders.insert(pl_pTilt, qMakePair(tr("Piece tilt"), QString()));
m_placeholders.insert(pl_pFoldPosition, qMakePair(tr("Piece fold position"), QString()));
m_placeholders.insert(pl_pName, qMakePair(tr("Piece name"), QString()));
m_placeholders.insert(pl_pQuantity, qMakePair(tr("Quantity"), QString()));
m_placeholders.insert(pl_mFabric, qMakePair(tr("Material: Fabric"), tr("Fabric")));
m_placeholders.insert(pl_mLining, qMakePair(tr("Material: Lining"), tr("Lining")));
m_placeholders.insert(pl_mInterfacing, qMakePair(tr("Material: Interfacing"), tr("Interfacing")));
m_placeholders.insert(pl_mInterlining, qMakePair(tr("Material: Interlining"), tr("Interlining")));
m_placeholders.insert(pl_wCut, qMakePair(tr("Word: Cut"), tr("Cut")));
m_placeholders.insert(pl_wOnFold, qMakePair(tr("Word: on fold"), QString(QString())));// By default should be empty
m_placeholders.insert(pl_wOnFold, qMakePair(tr("Word: on fold"), QString()));// By default should be empty
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -191,30 +191,30 @@ void DialogEditWrongFormula::ValChanged(int row)
if (ui->radioButtonStandardTable->isChecked())
{
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
SetDescription(item->text(), *stable->GetValue(), UnitsToStr(qApp->patternUnit(), true),
SetDescription(item->text(), *stable->GetValue(), UnitsToStr(qApp->patternUnits(), true),
stable->GetGuiText());
}
else if (ui->radioButtonIncrements->isChecked())
{
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(name);
SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnit(), true),
SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnits(), true),
incr->GetDescription());
}
else if (ui->radioButtonPC->isChecked())
{
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(name);
SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnit(), true),
SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnits(), true),
incr->GetDescription());
}
else if (ui->radioButtonLengthLine->isChecked())
{
SetDescription(item->text(), *data->GetVariable<VLengthLine>(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Line length"));
UnitsToStr(qApp->patternUnits(), true), tr("Line length"));
}
else if (ui->radioButtonLengthSpline->isChecked())
{
SetDescription(item->text(), *data->GetVariable<VCurveLength>(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Curve length"));
UnitsToStr(qApp->patternUnits(), true), tr("Curve length"));
}
else if (ui->radioButtonAngleLine->isChecked())
{
@ -224,7 +224,7 @@ void DialogEditWrongFormula::ValChanged(int row)
else if (ui->radioButtonRadiusesArcs->isChecked())
{
SetDescription(item->text(), *data->GetVariable<VArcRadius>(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Arc radius"));
UnitsToStr(qApp->patternUnits(), true), tr("Arc radius"));
}
else if (ui->radioButtonAnglesCurves->isChecked())
{

View File

@ -33,7 +33,7 @@
#include <QPushButton>
#include <Qt>
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vcommonsettings.h"
#include "ui_dialogundo.h"

View File

@ -141,7 +141,7 @@ void DialogAlongLine::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -157,7 +157,7 @@ void DialogAlongLine::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);

View File

@ -328,7 +328,7 @@ void DialogArc::FXRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetRadius());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius(dialog->GetFormula());
@ -375,7 +375,7 @@ void DialogArc::EvalRadius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius;
formulaData.labelResult = ui->labelResultRadius;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
const qreal radius = Eval(formulaData, flagRadius);

View File

@ -290,7 +290,7 @@ void DialogArcWithLength::FXRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetRadius());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius(dialog->GetFormula());
@ -318,7 +318,7 @@ void DialogArcWithLength::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit the arc length"));
dialog->SetFormula(GetLength());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetLength(dialog->GetFormula());
@ -367,7 +367,7 @@ void DialogArcWithLength::Radius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius;
formulaData.labelResult = ui->labelResultRadius;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkLessThanZero = true;
Eval(formulaData, flagRadius);
@ -381,7 +381,7 @@ void DialogArcWithLength::Length()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength;
formulaData.labelResult = ui->labelResultLength;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
Eval(formulaData, flagLength);
}

View File

@ -139,7 +139,7 @@ void DialogBisector::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -155,7 +155,7 @@ void DialogBisector::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);

View File

@ -102,7 +102,7 @@ void DialogCutArc::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -118,7 +118,7 @@ void DialogCutArc::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);

View File

@ -217,7 +217,7 @@ void DialogCutSpline::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -233,7 +233,7 @@ void DialogCutSpline::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);

View File

@ -217,7 +217,7 @@ void DialogCutSplinePath::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -233,7 +233,7 @@ void DialogCutSplinePath::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);

View File

@ -387,7 +387,7 @@ void DialogEllipticalArc::EvalRadiuses()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius1;
formulaData.labelResult = ui->labelResultRadius1;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkLessThanZero = true;
Eval(formulaData, flagRadius1);
@ -434,7 +434,7 @@ void DialogEllipticalArc::FXRadius1()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius1"));
dialog->SetFormula(GetRadius1());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius1(dialog->GetFormula());
@ -448,7 +448,7 @@ void DialogEllipticalArc::FXRadius2()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius2"));
dialog->SetFormula(GetRadius2());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius2(dialog->GetFormula());

View File

@ -150,7 +150,7 @@ void DialogEndLine::EvalLength()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkLessThanZero = false;
Eval(formulaData, flagFormula);
@ -188,7 +188,7 @@ void DialogEndLine::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());

View File

@ -479,7 +479,7 @@ void DialogMove::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetLength());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetLength(dialog->GetFormula());
@ -630,7 +630,7 @@ void DialogMove::EvalLength()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength;
formulaData.labelResult = ui->labelResultLength;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
Eval(formulaData, flagLength);
}

View File

@ -141,7 +141,7 @@ void DialogNormal::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -157,7 +157,7 @@ void DialogNormal::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
Eval(formulaData, flagFormula);
}

View File

@ -272,7 +272,7 @@ void DialogPointFromCircleAndTangent::FXCircleRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetCircleRadius());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetCircleRadius(dialog->GetFormula());
@ -288,7 +288,7 @@ void DialogPointFromCircleAndTangent::EvalCircleRadius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius;
formulaData.labelResult = ui->labelResultCircleRadius;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
const qreal radius = Eval(formulaData, flagCircleRadius);

View File

@ -149,7 +149,7 @@ void DialogPointOfContact::FXRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(getRadius());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
setRadius(dialog->GetFormula());
@ -165,7 +165,7 @@ void DialogPointOfContact::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
Eval(formulaData, flagFormula);
}

View File

@ -323,7 +323,7 @@ void DialogPointOfIntersectionCircles::FXCircle1Radius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first circle radius"));
dialog->SetFormula(GetFirstCircleRadius());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFirstCircleRadius(dialog->GetFormula());
@ -337,7 +337,7 @@ void DialogPointOfIntersectionCircles::FXCircle2Radius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second circle radius"));
dialog->SetFormula(GetSecondCircleRadius());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetSecondCircleRadius(dialog->GetFormula());
@ -353,7 +353,7 @@ void DialogPointOfIntersectionCircles::EvalCircle1Radius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditCircle1Radius;
formulaData.labelResult = ui->labelResultCircle1Radius;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
const qreal radius = Eval(formulaData, flagCircle1Radius);
@ -376,7 +376,7 @@ void DialogPointOfIntersectionCircles::EvalCircle2Radius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditCircle2Radius;
formulaData.labelResult = ui->labelResultCircle2Radius;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
const qreal radius = Eval(formulaData, flagCircle2Radius);

View File

@ -139,7 +139,7 @@ void DialogShoulderPoint::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@ -155,7 +155,7 @@ void DialogShoulderPoint::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
Eval(formulaData, flagFormula);
}

View File

@ -321,7 +321,7 @@ void DialogSpline::FXLength1()
QString length1F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength1F->toPlainText(),
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(length1F);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
length1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
@ -344,7 +344,7 @@ void DialogSpline::FXLength2()
QString length2F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength2F->toPlainText(),
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(length2F);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
length2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
@ -407,7 +407,7 @@ void DialogSpline::EvalLength1()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength1;
formulaData.labelResult = ui->labelResultLength1;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -422,7 +422,7 @@ void DialogSpline::EvalLength2()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength2;
formulaData.labelResult = ui->labelResultLength2;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;

View File

@ -447,7 +447,7 @@ void DialogSplinePath::FXLength1()
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(length1F);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
length1F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
@ -472,7 +472,7 @@ void DialogSplinePath::FXLength2()
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(length2F);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
length2F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
@ -553,7 +553,7 @@ void DialogSplinePath::EvalLength1()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength1;
formulaData.labelResult = ui->labelResultLength1;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -580,7 +580,7 @@ void DialogSplinePath::EvalLength2()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength2;
formulaData.labelResult = ui->labelResultLength2;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;

View File

@ -545,7 +545,7 @@ void DialogPiecePath::PassmarkChanged(int index)
if (passmarkLength.isEmpty())
{
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
}
else
@ -555,7 +555,7 @@ void DialogPiecePath::PassmarkChanged(int index)
}
else
{
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
}
@ -796,7 +796,7 @@ void DialogPiecePath::EvalWidth()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditWidth;
formulaData.labelResult = ui->labelResultWidth;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -827,7 +827,7 @@ void DialogPiecePath::EvalWidthBefore()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditBefore;
formulaData.labelResult = ui->labelResultBefore;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -862,7 +862,7 @@ void DialogPiecePath::EvalWidthAfter()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditAfter;
formulaData.labelResult = ui->labelResultAfter;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -910,7 +910,7 @@ void DialogPiecePath::EvalPassmarkLength()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditPassmarkLength;
formulaData.labelResult = ui->labelResultPassmarkLength;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = false;
@ -927,7 +927,7 @@ void DialogPiecePath::FXWidth()
dialog->setWindowTitle(tr("Edit seam allowance width"));
dialog->SetFormula(GetFormulaSAWidth());
dialog->setCheckLessThanZero(true);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormulaSAWidth(dialog->GetFormula());
@ -941,7 +941,7 @@ void DialogPiecePath::FXWidthBefore()
dialog->setWindowTitle(tr("Edit seam allowance width before"));
dialog->SetFormula(GetFormulaSAWidthBefore());
dialog->setCheckLessThanZero(true);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetCurrentSABefore(dialog->GetFormula());
@ -955,7 +955,7 @@ void DialogPiecePath::FXWidthAfter()
dialog->setWindowTitle(tr("Edit seam allowance width after"));
dialog->SetFormula(GetFormulaSAWidthAfter());
dialog->setCheckLessThanZero(true);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetCurrentSAAfter(dialog->GetFormula());
@ -980,7 +980,7 @@ void DialogPiecePath::FXPassmarkLength()
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
dialog->setWindowTitle(tr("Edit passmark length"));
dialog->SetFormula(GetFormulaPassmarkLength());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormulaPassmarkLength(dialog->GetFormula());
@ -1099,7 +1099,7 @@ void DialogPiecePath::InitSeamAllowanceTab()
connect(m_timerWidthAfter, &QTimer::timeout, this, &DialogPiecePath::EvalWidthAfter);
// Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough.
m_saWidth = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
m_saWidth = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
ui->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth));
InitNodesList();

View File

@ -315,7 +315,7 @@ void DialogPlaceLabel::EvalWidth()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormulaWidth;
formulaData.labelResult = ui->labelResultCalculationWidth;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkLessThanZero = true;
Eval(formulaData, m_flagWidth);
@ -329,7 +329,7 @@ void DialogPlaceLabel::EvalHeight()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormulaHeight;
formulaData.labelResult = ui->labelResultCalculationHeight;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkLessThanZero = true;
Eval(formulaData, m_flagHeight);
@ -370,7 +370,7 @@ void DialogPlaceLabel::FXWidth()
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
dialog->setWindowTitle(tr("Edit rectangle width"));
dialog->SetFormula(GetWidth());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetWidth(dialog->GetFormula());
@ -383,7 +383,7 @@ void DialogPlaceLabel::FXHeight()
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
dialog->setWindowTitle(tr("Edit rectangle width"));
dialog->SetFormula(GetHeight());
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetHeight(dialog->GetFormula());
@ -429,8 +429,8 @@ void DialogPlaceLabel::InitPlaceLabelTab()
ui->plainTextEditFormulaHeight->installEventFilter(this);
ui->plainTextEditFormulaAngle->installEventFilter(this);
ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnits())));
ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnits())));
connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPlaceLabel::FXWidth);
connect(ui->toolButtonExprHeight, &QPushButton::clicked, this, &DialogPlaceLabel::FXHeight);

View File

@ -1050,7 +1050,7 @@ void DialogSeamAllowance::PassmarkChanged(int index)
if (passmarkLength.isEmpty())
{
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
}
else
@ -1060,7 +1060,7 @@ void DialogSeamAllowance::PassmarkChanged(int index)
}
else
{
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
}
@ -1598,7 +1598,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
{
plbVal = uiTabGrainline->labelLen;
plbText = uiTabGrainline->labelEditLen;
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits());
}
plbVal->setToolTip(tr("Value"));
@ -1667,13 +1667,13 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
{
plbVal = uiTabLabels->labelDLWidth;
plbText = uiTabLabels->labelEditDLWidth;
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits());
}
else if (i == 1)
{
plbVal = uiTabLabels->labelDLHeight;
plbText = uiTabLabels->labelEditDLHeight;
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits());
}
else
{
@ -1753,13 +1753,13 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
{
plbVal = uiTabLabels->labelPLWidth;
plbText = uiTabLabels->labelEditPLWidth;
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits());
}
else if (i == 1)
{
plbVal = uiTabLabels->labelPLHeight;
plbText = uiTabLabels->labelEditPLHeight;
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit());
qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits());
}
else
{
@ -2133,7 +2133,7 @@ void DialogSeamAllowance::EvalWidth()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = uiTabPaths->labelEditWidth;
formulaData.labelResult = uiTabPaths->labelResultWidth;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -2166,7 +2166,7 @@ void DialogSeamAllowance::EvalWidthBefore()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = uiTabPaths->labelEditBefore;
formulaData.labelResult = uiTabPaths->labelResultBefore;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -2197,7 +2197,7 @@ void DialogSeamAllowance::EvalWidthAfter()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = uiTabPaths->labelEditAfter;
formulaData.labelResult = uiTabPaths->labelResultAfter;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@ -2228,7 +2228,7 @@ void DialogSeamAllowance::EvalPassmarkLength()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkLength;
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkLength;
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = false;
@ -2252,7 +2252,7 @@ void DialogSeamAllowance::FXWidth()
dialog->setWindowTitle(tr("Edit seam allowance width"));
dialog->SetFormula(GetFormulaSAWidth());
dialog->setCheckLessThanZero(true);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormulaSAWidth(dialog->GetFormula());
@ -2266,7 +2266,7 @@ void DialogSeamAllowance::FXWidthBefore()
dialog->setWindowTitle(tr("Edit seam allowance width before"));
dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore));
dialog->setCheckLessThanZero(true);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetCurrentSABefore(dialog->GetFormula());
@ -2280,7 +2280,7 @@ void DialogSeamAllowance::FXWidthAfter()
dialog->setWindowTitle(tr("Edit seam allowance width after"));
dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter));
dialog->setCheckLessThanZero(true);
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetCurrentSAAfter(dialog->GetFormula());
@ -2293,7 +2293,7 @@ void DialogSeamAllowance::FXPassmarkLength()
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
dialog->setWindowTitle(tr("Edit passmark length"));
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength));
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormularPassmarkLength(dialog->GetFormula());
@ -2923,7 +2923,7 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
// init the default seam allowance, convert the value if app unit is different than pattern unit
m_saWidth = UnitConvertor(qApp->Settings()->GetDefaultSeamAllowance(),
StrToUnits(qApp->Settings()->GetUnit()), qApp->patternUnit());
StrToUnits(qApp->Settings()->GetUnit()), qApp->patternUnits());
uiTabPaths->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth));

View File

@ -890,7 +890,7 @@ QString VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const
"</table>")
.arg(tr("Label"), curve->name(), tr("Length"))
.arg(qApp->fromPixel(curve->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), MakeToolTip());
.arg(UnitsToStr(qApp->patternUnits(), true), MakeToolTip());
return toolTip;
}

View File

@ -398,7 +398,7 @@ VFormula VToolMove::GetFormulaLength() const
VFormula fLength(formulaLength, getData());
fLength.setCheckZero(true);
fLength.setToolId(m_id);
fLength.setPostfix(UnitsToStr(qApp->patternUnit()));
fLength.setPostfix(UnitsToStr(qApp->patternUnits()));
fLength.Eval();
return fLength;
}
@ -523,7 +523,7 @@ QString VToolMove::MakeToolTip() const
.arg(GetFormulaAngle().getDoubleValue()) // 2
.arg(tr("Length")) // 3
.arg(GetFormulaLength().getDoubleValue()) // 4
.arg(UnitsToStr(qApp->patternUnit(), true), // 5
.arg(UnitsToStr(qApp->patternUnits(), true), // 5
tr("Rotation angle")) // 6
.arg(GetFormulaRotationAngle().getDoubleValue()) // 7
.arg(tr("Rotation origin point"), // 8

View File

@ -202,7 +202,7 @@ QString VAbstractSpline::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curve->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Label"), curve->name());
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Label"), curve->name());
return toolTip;
}

View File

@ -192,7 +192,7 @@ VFormula VToolArc::GetFormulaRadius() const
VFormula radius(arc->GetFormulaRadius(), getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;
}
@ -387,7 +387,7 @@ QString VToolArc::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(arc->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Radius"))
.arg(qApp->fromPixel(arc->GetRadius()))
.arg(tr("Start angle"))
.arg(arc->GetStartAngle())

View File

@ -173,7 +173,7 @@ VFormula VToolArcWithLength::GetFormulaRadius() const
VFormula radius(arc->GetFormulaRadius(), getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;
}
@ -232,7 +232,7 @@ VFormula VToolArcWithLength::GetFormulaLength() const
VFormula radius(arc->GetFormulaLength(), getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;
}
@ -366,7 +366,7 @@ QString VToolArcWithLength::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(arc->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Radius"))
.arg(qApp->fromPixel(arc->GetRadius()))
.arg(tr("Start angle"))
.arg(arc->GetStartAngle())

View File

@ -201,7 +201,7 @@ VFormula VToolEllipticalArc::GetFormulaRadius1() const
VFormula radius1(elArc->GetFormulaRadius1(), getData());
radius1.setCheckZero(true);
radius1.setToolId(m_id);
radius1.setPostfix(UnitsToStr(qApp->patternUnit()));
radius1.setPostfix(UnitsToStr(qApp->patternUnits()));
radius1.Eval();
return radius1;
}
@ -230,7 +230,7 @@ VFormula VToolEllipticalArc::GetFormulaRadius2() const
VFormula radius2(elArc->GetFormulaRadius2(), getData());
radius2.setCheckZero(true);
radius2.setToolId(m_id);
radius2.setPostfix(UnitsToStr(qApp->patternUnit()));
radius2.setPostfix(UnitsToStr(qApp->patternUnits()));
radius2.Eval();
return radius2;
}
@ -440,7 +440,7 @@ QString VToolEllipticalArc::MakeToolTip() const
"</table>")
.arg(tr("Length")) // 1
.arg(qApp->fromPixel(elArc->GetLength())) // 2
.arg(UnitsToStr(qApp->patternUnit(), true), // 3
.arg(UnitsToStr(qApp->patternUnits(), true), // 3
tr("Radius") + QLatin1Char('1')) // 4
.arg(qApp->fromPixel(elArc->GetRadius1())) // 5
.arg(tr("Radius") + QLatin1Char('2')) // 6

View File

@ -83,7 +83,7 @@ VFormula VToolCut::GetFormula() const
VFormula val(formula, getData());
val.setCheckZero(true);
val.setToolId(m_id);
val.setPostfix(UnitsToStr(qApp->patternUnit()));
val.setPostfix(UnitsToStr(qApp->patternUnits()));
val.Eval();
return val;
}

View File

@ -283,7 +283,7 @@ QString VToolCutArc::MakeToolTip() const
"<tr> <td><b>%8:</b> %9°</td> </tr>")
.arg(arcStr + arcNumber + QChar(QChar::Space) + lengthStr)
.arg(qApp->fromPixel(arc.GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), arcStr + arcNumber + QChar(QChar::Space) + radiusStr)
.arg(UnitsToStr(qApp->patternUnits(), true), arcStr + arcNumber + QChar(QChar::Space) + radiusStr)
.arg(qApp->fromPixel(arc.GetRadius()))
.arg(arcStr + arcNumber + QChar(QChar::Space) + startAngleStr)
.arg(arc.GetStartAngle())

View File

@ -277,7 +277,7 @@ QString VToolCutSpline::MakeToolTip() const
"</table>")
.arg(curveStr + QLatin1String("1 ") + lengthStr)
.arg(qApp->fromPixel(spline1.GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr)
.arg(UnitsToStr(qApp->patternUnits(), true), curveStr + QLatin1String("2 ") + lengthStr)
.arg(qApp->fromPixel(spline2.GetLength()))
.arg(curveStr + QLatin1String(" 1") + tr("label"), spline1.name(),
curveStr + QLatin1String(" 2") + tr("label"), spline2.name());

View File

@ -367,7 +367,7 @@ QString VToolCutSplinePath::MakeToolTip() const
"</table>")
.arg(curveStr + QLatin1String("1 ") + lengthStr)
.arg(qApp->fromPixel(splPath1->GetLength()))
.arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr)
.arg(UnitsToStr(qApp->patternUnits(), true), curveStr + QLatin1String("2 ") + lengthStr)
.arg(qApp->fromPixel(splPath2->GetLength()))
.arg(curveStr + QLatin1String(" 1") + tr("label"), splPath1->name(),
curveStr + QLatin1String(" 2") + tr("label"), splPath2->name());

View File

@ -162,7 +162,7 @@ QString VToolAlongLine::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curLine.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle"))
.arg(curLine.angle())
.arg(QStringLiteral("%1->%2").arg(basePoint->name(), current->name()),
QStringLiteral("%1->%2").arg(current->name(), secondPoint->name()))

View File

@ -143,7 +143,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(VToolCurveIntersectAxis
" through point '%3' with angle %4°")
.arg(initData.name, curve->name(), basePoint->name()).arg(angle);
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
const qreal segLength = curve->GetLengthByPoint(fPoint);

View File

@ -281,7 +281,7 @@ QString VToolHeight::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curLine.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle"))
.arg(curLine.angle())
.arg(QString("%1->%2").arg(p1Line->name(), current->name()))
.arg(qApp->fromPixel(p1ToCur.length()))

View File

@ -135,7 +135,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(VToolLineIntersectAxisIni
"through point '%4' and angle %5°")
.arg(initData.name, firstPoint->name(), secondPoint->name(), basePoint->name()).arg(axis.angle());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
@ -342,7 +342,7 @@ QString VToolLineIntersectAxis::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(curLine.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle"))
.arg(curLine.angle())
.arg(QString("%1->%2").arg(firstPoint->name(), current->name()))
.arg(qApp->fromPixel(firstToCur.length()))

View File

@ -158,7 +158,7 @@ QString VToolLinePoint::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(line.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle"))
.arg(line.angle())
.arg(tr("Label"), second->name());
return toolTip;
@ -217,7 +217,7 @@ VFormula VToolLinePoint::GetFormulaLength() const
VFormula fLength(formulaLength, this->getData());
fLength.setCheckZero(false);
fLength.setToolId(m_id);
fLength.setPostfix(UnitsToStr(qApp->patternUnit()));
fLength.setPostfix(UnitsToStr(qApp->patternUnits()));
fLength.Eval();
return fLength;

View File

@ -339,7 +339,7 @@ QString VToolShoulderPoint::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(firstToCur.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle"))
.arg(firstToCur.angle())
.arg(QString("%1->%2").arg(second->name(), current->name()))
.arg(qApp->fromPixel(secondToCur.length()))

View File

@ -150,7 +150,7 @@ VToolLineIntersect* VToolLineIntersect::Create(VToolLineIntersectInitData initDa
"intersection")
.arg(initData.name, p1Line1->name(), p2Line1->name(), p1Line2->name(), p2Line2->name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
@ -321,7 +321,7 @@ QString VToolLineIntersect::MakeToolTip() const
"</table>")
.arg(QString("%1->%2").arg(p1L1->name(), current->name()))
.arg(qApp->fromPixel(p1L1ToCur.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), QString("%1->%2").arg(current->name(), p2L1->name()))
.arg(UnitsToStr(qApp->patternUnits(), true), QString("%1->%2").arg(current->name(), p2L1->name()))
.arg(qApp->fromPixel(curToP2L1.length()))
.arg(QString("%1->%2").arg(p1L2->name(), current->name()))
.arg(qApp->fromPixel(p1L2ToCur.length()))

View File

@ -122,7 +122,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(VToolPointFromA
const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found")
.arg(initData.name, arc.name(), tPoint.name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);

View File

@ -131,7 +131,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(VToolPoin
.arg(initData.name, cPoint.name()).arg(radius).arg(tPoint.name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
@ -206,7 +206,7 @@ VFormula VToolPointFromCircleAndTangent::GetCircleRadius() const
VFormula radius(circleRadius, getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;
}

View File

@ -217,7 +217,7 @@ VToolPointOfContact* VToolPointOfContact::Create(VToolPointOfContactInitData &in
"intersection with line (%4;%5)")
.arg(initData.name, centerP->name()).arg(result).arg(firstP->name(), secondP->name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
@ -373,7 +373,7 @@ QString VToolPointOfContact::MakeToolTip() const
"</table>")
.arg(QStringLiteral("%1->%2").arg(p1->name(), current->name()))
.arg(qApp->fromPixel(p1ToCur.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), QStringLiteral("%1->%2").arg(p2->name(), current->name()))
.arg(UnitsToStr(qApp->patternUnits(), true), QStringLiteral("%1->%2").arg(p2->name(), current->name()))
.arg(qApp->fromPixel(p2ToCur.length()))
.arg(QStringLiteral("%1 %2->%3").arg(tr("Length"), centerP->name(), current->name()))
.arg(qApp->fromPixel(centerToCur.length()))
@ -409,7 +409,7 @@ VFormula VToolPointOfContact::getArcRadius() const
VFormula radius(arcRadius, this->getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;

View File

@ -121,7 +121,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(VToolPointOfI
const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection")
.arg(initData.name, firstArc->name(), secondArc->name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);

View File

@ -135,7 +135,7 @@ VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInitData
const QString errorMsg = tr("Error calculating point '%1'. Circles with centers in points '%2' and '%3' have "
"no point of intersection").arg(initData.name, c1Point.name(), c2Point.name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
@ -219,7 +219,7 @@ VFormula VToolPointOfIntersectionCircles::GetFirstCircleRadius() const
VFormula radius(firstCircleRadius, getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;
}
@ -244,7 +244,7 @@ VFormula VToolPointOfIntersectionCircles::GetSecondCircleRadius() const
VFormula radius(secondCircleRadius, getData());
radius.setCheckZero(true);
radius.setToolId(m_id);
radius.setPostfix(UnitsToStr(qApp->patternUnit()));
radius.setPostfix(UnitsToStr(qApp->patternUnits()));
radius.Eval();
return radius;
}

View File

@ -126,7 +126,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(VToolPoin
const QString errorMsg = tr("Error calculating point '%1'. Curves '%2' and '%3' have no point of intersection")
.arg(initData.name, curve1->name(), curve2->name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);

View File

@ -148,7 +148,7 @@ VToolTriangle* VToolTriangle::Create(VToolTriangleInitData initData)
const QString errorMsg = tr("Error calculating point '%1'. Point of intersection cannot be found")
.arg(initData.name);
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);

View File

@ -442,7 +442,7 @@ QString VToolLine::MakeToolTip() const
"</table>")
.arg(tr("Length"))
.arg(qApp->fromPixel(line.length()))
.arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle"))
.arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle"))
.arg(line.angle());
return toolTip;
}

View File

@ -1321,7 +1321,7 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
.arg(detail.GetName());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
path.addPath(detail.SeamAllowancePath(futureSeamAllowance.result()));
path.setFillRule(Qt::OddEvenFill);

View File

@ -33,7 +33,7 @@
#include "../vwidgets/vmaingraphicsview.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/customevents.h"
#include "vundocommand.h"

View File

@ -31,7 +31,7 @@
#include <QDomNode>
#include <QDomNodeList>
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../ifc/xml/vabstractpattern.h"
#include "vundocommand.h"

View File

@ -32,7 +32,7 @@
#include "../ifc/ifcdef.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "vundocommand.h"
//---------------------------------------------------------------------------------------------------------------------

View File

@ -32,7 +32,7 @@
#include "../ifc/ifcdef.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/def.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "../vgeometry/vpointf.h"

View File

@ -32,7 +32,7 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/def.h"
#include "vundocommand.h"

View File

@ -31,7 +31,7 @@
#include <QDomNode>
#include <QDomNodeList>
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/def.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "../ifc/xml/vabstractpattern.h"

View File

@ -170,7 +170,7 @@ void VisToolMove::RefreshGeometry()
DrawLine(this, line, supportColor2, Qt::DashLine);
DrawPoint(pointFinish, line.p2(), supportColor);
static const QString prefix = UnitsToStr(qApp->patternUnit(), true);
static const QString prefix = UnitsToStr(qApp->patternUnits(), true);
if (qFuzzyIsNull(length))
{
Visualization::toolTip = tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, "

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