Vera++.
--HG-- branch : develop
This commit is contained in:
parent
3e363aea81
commit
507ccd686e
|
@ -91,7 +91,7 @@ Calculator::Calculator(const QString &formula, bool fromUser)
|
||||||
SetVarFactory(AddVariable, this);
|
SetVarFactory(AddVariable, this);
|
||||||
|
|
||||||
// Add unary operators
|
// Add unary operators
|
||||||
if(fromUser)
|
if (fromUser)
|
||||||
{
|
{
|
||||||
DefinePostfixOprt(qApp->PostfixOperator(cm_Oprt), CmUnit);
|
DefinePostfixOprt(qApp->PostfixOperator(cm_Oprt), CmUnit);
|
||||||
DefinePostfixOprt(qApp->PostfixOperator(mm_Oprt), MmUnit);
|
DefinePostfixOprt(qApp->PostfixOperator(mm_Oprt), MmUnit);
|
||||||
|
@ -292,7 +292,7 @@ void Calculator::InitCharacterSets()
|
||||||
qreal Calculator::CmUnit(qreal val)
|
qreal Calculator::CmUnit(qreal val)
|
||||||
{
|
{
|
||||||
qreal unit = val;
|
qreal unit = val;
|
||||||
switch(qApp->patternUnit())
|
switch (qApp->patternUnit())
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
unit = val * 10.0;
|
unit = val * 10.0;
|
||||||
|
@ -313,7 +313,7 @@ qreal Calculator::CmUnit(qreal val)
|
||||||
qreal Calculator::MmUnit(qreal val)
|
qreal Calculator::MmUnit(qreal val)
|
||||||
{
|
{
|
||||||
qreal unit = val;
|
qreal unit = val;
|
||||||
switch(qApp->patternUnit())
|
switch (qApp->patternUnit())
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
break;
|
break;
|
||||||
|
@ -334,7 +334,7 @@ qreal Calculator::MmUnit(qreal val)
|
||||||
qreal Calculator::InchUnit(qreal val)
|
qreal Calculator::InchUnit(qreal val)
|
||||||
{
|
{
|
||||||
qreal unit = val;
|
qreal unit = val;
|
||||||
switch(qApp->patternUnit())
|
switch (qApp->patternUnit())
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
unit = val * 25.4;
|
unit = val * 25.4;
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool DialogPatternXmlEdit::ApplyAttributeChange(QDomNode domElement, QString nam
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
domElement.toElement().setAttribute(name,value);
|
domElement.toElement().setAttribute(name, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ void DialogPatternXmlEdit::ButtonApplyChangesClicked()
|
||||||
currentChange=currentChange->next;
|
currentChange=currentChange->next;
|
||||||
}
|
}
|
||||||
QString message;
|
QString message;
|
||||||
if (this->CheckChanges(message,newroot) == false)
|
if (this->CheckChanges(message, newroot) == false)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, "Error in changes", message);
|
QMessageBox::warning(this, "Error in changes", message);
|
||||||
return;
|
return;
|
||||||
|
@ -719,8 +719,8 @@ void DialogPatternXmlEdit::ButtonAddSonClicked()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString value = QInputDialog::getText(this, tr("Node Value (may be empty)"),tr("Value:"),
|
QString value = QInputDialog::getText(this, tr("Node Value (may be empty)"), tr("Value:"),
|
||||||
QLineEdit::Normal,"", &ok);
|
QLineEdit::Normal, "", &ok);
|
||||||
if (ok==false)
|
if (ok==false)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -202,9 +202,9 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
|
|
||||||
QString checkedUnit = settings.value("configuration/unit", "cm").toString();
|
QString checkedUnit = settings.value("configuration/unit", "cm").toString();
|
||||||
|
|
||||||
this->unitCombo->addItem(tr("Centimeters"),"cm");
|
this->unitCombo->addItem(tr("Centimeters"), "cm");
|
||||||
this->unitCombo->addItem(tr("Milimiters"),"mm");
|
this->unitCombo->addItem(tr("Milimiters"), "mm");
|
||||||
this->unitCombo->addItem(tr("Inches"),"in");
|
this->unitCombo->addItem(tr("Inches"), "in");
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
qint32 indexUnit = this->unitCombo->findData(checkedUnit);
|
qint32 indexUnit = this->unitCombo->findData(checkedUnit);
|
||||||
|
@ -368,15 +368,15 @@ void CommunityPage::Apply()
|
||||||
QApplication::applicationName());
|
QApplication::applicationName());
|
||||||
settings.setValue("community/server", this->server->text());
|
settings.setValue("community/server", this->server->text());
|
||||||
settings.setValue("community/serverSecure", this->secureComm->isChecked());
|
settings.setValue("community/serverSecure", this->secureComm->isChecked());
|
||||||
settings.setValue("community/useProxy",this->useProxy->isChecked());
|
settings.setValue("community/useProxy", this->useProxy->isChecked());
|
||||||
settings.setValue("community/proxyAddress",this->proxyAddress->text());
|
settings.setValue("community/proxyAddress", this->proxyAddress->text());
|
||||||
settings.setValue("community/proxyPort",this->proxyPort->text());
|
settings.setValue("community/proxyPort", this->proxyPort->text());
|
||||||
settings.setValue("community/proxyUser",this->proxyUser->text());
|
settings.setValue("community/proxyUser", this->proxyUser->text());
|
||||||
settings.setValue("community/proxyPass",this->proxyPass->text());
|
settings.setValue("community/proxyPass", this->proxyPass->text());
|
||||||
|
|
||||||
settings.setValue("community/username",this->username->text());
|
settings.setValue("community/username", this->username->text());
|
||||||
settings.setValue("community/savePassword",this->savePassword->isChecked());
|
settings.setValue("community/savePassword", this->savePassword->isChecked());
|
||||||
settings.setValue("community/userpassword",this->userpassword->text());
|
settings.setValue("community/userpassword", this->userpassword->text());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,10 +414,10 @@ QGroupBox *CommunityPage::ServerGroup()
|
||||||
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
||||||
QFormLayout *serverLayout = new QFormLayout;
|
QFormLayout *serverLayout = new QFormLayout;
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->server,serverLayout,
|
CommunityPage::add_lineedit(&this->server, serverLayout,
|
||||||
settings.value("community/server", "community.valentina-project.org").toString(), tr("Server name/IP"));
|
settings.value("community/server", "community.valentina-project.org").toString(), tr("Server name/IP"));
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->secureComm,serverLayout,
|
CommunityPage::add_checkbox(&this->secureComm, serverLayout,
|
||||||
settings.value("community/serverSecure", 0).toBool(), tr("Secure connection"));
|
settings.value("community/serverSecure", 0).toBool(), tr("Secure connection"));
|
||||||
|
|
||||||
ServerGroup->setLayout(serverLayout);
|
ServerGroup->setLayout(serverLayout);
|
||||||
|
|
|
@ -156,7 +156,7 @@ void DialogAlongLine::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ void DialogArc::DialogApply()
|
||||||
void DialogArc::SaveData()
|
void DialogArc::SaveData()
|
||||||
{
|
{
|
||||||
radius = ui->plainTextEditFormula->toPlainText();
|
radius = ui->plainTextEditFormula->toPlainText();
|
||||||
radius.replace("\n"," ");
|
radius.replace("\n", " ");
|
||||||
f1 = ui->lineEditF1->text();
|
f1 = ui->lineEditF1->text();
|
||||||
f2 = ui->lineEditF2->text();
|
f2 = ui->lineEditF2->text();
|
||||||
center = getCurrentObjectId(ui->comboBoxBasePoint);
|
center = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
|
|
|
@ -247,7 +247,7 @@ void DialogBisector::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
thirdPointId = getCurrentObjectId(ui->comboBoxThirdPoint);
|
thirdPointId = getCurrentObjectId(ui->comboBoxThirdPoint);
|
||||||
|
|
|
@ -138,7 +138,7 @@ void DialogCutArc::SaveData()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
arcId = getCurrentObjectId(ui->comboBoxArc);
|
arcId = getCurrentObjectId(ui->comboBoxArc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
#include "dialogtool.h"
|
#include "dialogtool.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class DialogEditWrongFormula;
|
class DialogEditWrongFormula;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ void DialogEndLine::DeployFormulaTextEdit()
|
||||||
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
|
||||||
//Set icon from theme (internal for Windows system)
|
//Set icon from theme (internal for Windows system)
|
||||||
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
|
||||||
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void DialogEndLine::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
angle = ui->doubleSpinBoxAngle->value();
|
angle = ui->doubleSpinBoxAngle->value();
|
||||||
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ void DialogNormal::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
angle = ui->doubleSpinBoxAngle->value();
|
angle = ui->doubleSpinBoxAngle->value();
|
||||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
|
|
|
@ -198,7 +198,7 @@ void DialogPointOfContact::SaveData()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
radius = ui->plainTextEditFormula->toPlainText();
|
radius = ui->plainTextEditFormula->toPlainText();
|
||||||
radius.replace("\n"," ");
|
radius.replace("\n", " ");
|
||||||
center = getCurrentObjectId(ui->comboBoxCenter);
|
center = getCurrentObjectId(ui->comboBoxCenter);
|
||||||
firstPoint = getCurrentObjectId(ui->comboBoxFirstPoint);
|
firstPoint = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPoint = getCurrentObjectId(ui->comboBoxSecondPoint);
|
secondPoint = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
|
|
|
@ -176,7 +176,7 @@ void DialogShoulderPoint::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
||||||
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
||||||
pShoulder = getCurrentObjectId(ui->comboBoxPShoulder);
|
pShoulder = getCurrentObjectId(ui->comboBoxPShoulder);
|
||||||
|
|
|
@ -467,7 +467,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
||||||
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
label->setText(tr("Error"));
|
label->setText(tr("Error"));
|
||||||
flag = false;
|
flag = false;
|
||||||
|
@ -504,7 +504,7 @@ void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *l
|
||||||
{
|
{
|
||||||
// Replace line return with spaces for calc
|
// Replace line return with spaces for calc
|
||||||
QString formula = edit->toPlainText();
|
QString formula = edit->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n", " ");
|
||||||
formula = qApp->FormulaFromUser(formula);
|
formula = qApp->FormulaFromUser(formula);
|
||||||
Calculator *cal = new Calculator(data);
|
Calculator *cal = new Calculator(data);
|
||||||
const qreal result = cal->EvalFormula(formula);
|
const qreal result = cal->EvalFormula(formula);
|
||||||
|
@ -528,7 +528,7 @@ void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *l
|
||||||
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
label->setText(tr("Error"));
|
label->setText(tr("Error"));
|
||||||
flag = false;
|
flag = false;
|
||||||
|
|
|
@ -379,7 +379,7 @@ void MainWindow::ApplyDialog()
|
||||||
void MainWindow::ToolEndLine(bool checked)
|
void MainWindow::ToolEndLine(bool checked)
|
||||||
{
|
{
|
||||||
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
||||||
&MainWindow::ClosedDialogEndLine,&MainWindow::ApplyDialogEndLine);
|
&MainWindow::ClosedDialogEndLine, &MainWindow::ApplyDialogEndLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -189,7 +189,7 @@ qreal VDrawTool::CheckFormula(QString &formula, VContainer *data)
|
||||||
result = cal->EvalFormula(formula);
|
result = cal->EvalFormula(formula);
|
||||||
delete cal;
|
delete cal;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
delete cal;
|
delete cal;
|
||||||
|
|
|
@ -139,5 +139,3 @@ int SaveDetailOptions::id() const
|
||||||
{
|
{
|
||||||
return static_cast<int>(UndoCommand::SaveDetailOptions);
|
return static_cast<int>(UndoCommand::SaveDetailOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ class SaveToolOptions : public QObject, public QUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VPattern *doc, const quint32 &id, QUndoCommand *parent = 0);
|
SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VPattern *doc, const quint32 &id,
|
||||||
|
QUndoCommand *parent = 0);
|
||||||
virtual ~SaveToolOptions();
|
virtual ~SaveToolOptions();
|
||||||
virtual void undo();
|
virtual void undo();
|
||||||
virtual void redo();
|
virtual void redo();
|
||||||
|
|
|
@ -439,7 +439,7 @@ void VApplication::InitMeasurements()
|
||||||
"Full measurement description");
|
"Full measurement description");
|
||||||
|
|
||||||
measurements.insert(acrossBackShoulderWidth_M, m);
|
measurements.insert(acrossBackShoulderWidth_M, m);
|
||||||
guiTexts.insert(acrossBackShoulderWidth_M,g );
|
guiTexts.insert(acrossBackShoulderWidth_M, g );
|
||||||
descriptions.insert(acrossBackShoulderWidth_M, d);
|
descriptions.insert(acrossBackShoulderWidth_M, d);
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
m = VTranslation::translate("Measurements", "upper_back_width",
|
m = VTranslation::translate("Measurements", "upper_back_width",
|
||||||
|
@ -1528,7 +1528,7 @@ bool VApplication::MeasurementsFromUser(QString &newFormula, int position, const
|
||||||
QMap<QString, VTranslation>::const_iterator i = measurements.constBegin();
|
QMap<QString, VTranslation>::const_iterator i = measurements.constBegin();
|
||||||
while (i != measurements.constEnd())
|
while (i != measurements.constEnd())
|
||||||
{
|
{
|
||||||
if(token == i.value().translate())
|
if (token == i.value().translate())
|
||||||
{
|
{
|
||||||
newFormula.replace(position, token.length(), i.key());
|
newFormula.replace(position, token.length(), i.key());
|
||||||
bias = token.length() - i.key().length();
|
bias = token.length() - i.key().length();
|
||||||
|
@ -1545,7 +1545,7 @@ bool VApplication::VariablesFromUser(QString &newFormula, int position, const QS
|
||||||
QMap<QString, VTranslation>::const_iterator i = variables.constBegin();
|
QMap<QString, VTranslation>::const_iterator i = variables.constBegin();
|
||||||
while (i != variables.constEnd())
|
while (i != variables.constEnd())
|
||||||
{
|
{
|
||||||
if(token.indexOf( i.value().translate() ) == 0)
|
if (token.indexOf( i.value().translate() ) == 0)
|
||||||
{
|
{
|
||||||
newFormula.replace(position, i.value().translate().length(), i.key());
|
newFormula.replace(position, i.value().translate().length(), i.key());
|
||||||
QString newToken = token;
|
QString newToken = token;
|
||||||
|
@ -1564,7 +1564,7 @@ bool VApplication::PostfixOperatorsFromUser(QString &newFormula, int position, c
|
||||||
QMap<QString, VTranslation>::const_iterator i = postfixOperators.constBegin();
|
QMap<QString, VTranslation>::const_iterator i = postfixOperators.constBegin();
|
||||||
while (i != postfixOperators.constEnd())
|
while (i != postfixOperators.constEnd())
|
||||||
{
|
{
|
||||||
if(token == i.value().translate())
|
if (token == i.value().translate())
|
||||||
{
|
{
|
||||||
newFormula.replace(position, token.length(), i.key());
|
newFormula.replace(position, token.length(), i.key());
|
||||||
bias = token.length() - i.key().length();
|
bias = token.length() - i.key().length();
|
||||||
|
@ -1581,7 +1581,7 @@ bool VApplication::FunctionsFromUser(QString &newFormula, int position, const QS
|
||||||
QMap<QString, VTranslation>::const_iterator i = functions.constBegin();
|
QMap<QString, VTranslation>::const_iterator i = functions.constBegin();
|
||||||
while (i != functions.constEnd())
|
while (i != functions.constEnd())
|
||||||
{
|
{
|
||||||
if(token == i.value().translate())
|
if (token == i.value().translate())
|
||||||
{
|
{
|
||||||
newFormula.replace(position, token.length(), i.key());
|
newFormula.replace(position, token.length(), i.key());
|
||||||
bias = token.length() - i.key().length();
|
bias = token.length() - i.key().length();
|
||||||
|
@ -1598,7 +1598,7 @@ bool VApplication::VariablesToUser(QString &newFormula, int position, const QStr
|
||||||
QMap<QString, VTranslation>::const_iterator i = variables.constBegin();
|
QMap<QString, VTranslation>::const_iterator i = variables.constBegin();
|
||||||
while (i != variables.constEnd())
|
while (i != variables.constEnd())
|
||||||
{
|
{
|
||||||
if(token.indexOf( i.key() ) == 0)
|
if (token.indexOf( i.key() ) == 0)
|
||||||
{
|
{
|
||||||
newFormula.replace(position, i.key().length(), i.value().translate());
|
newFormula.replace(position, i.key().length(), i.value().translate());
|
||||||
|
|
||||||
|
@ -1615,7 +1615,7 @@ bool VApplication::VariablesToUser(QString &newFormula, int position, const QStr
|
||||||
void VApplication::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
|
void VApplication::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
|
||||||
QMap<int, QString> &numbers)
|
QMap<int, QString> &numbers)
|
||||||
{
|
{
|
||||||
if(bias == 0)
|
if (bias == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1630,7 +1630,7 @@ void VApplication::BiasTokens(int position, int bias, QMap<int, QString> &tokens
|
||||||
QMap<int, QString>::const_iterator i = tokens.constBegin();
|
QMap<int, QString>::const_iterator i = tokens.constBegin();
|
||||||
while (i != tokens.constEnd())
|
while (i != tokens.constEnd())
|
||||||
{
|
{
|
||||||
if(i.key()<= position)
|
if (i.key()<= position)
|
||||||
{
|
{
|
||||||
newTokens.insert(i.key(), i.value());
|
newTokens.insert(i.key(), i.value());
|
||||||
}
|
}
|
||||||
|
@ -1670,7 +1670,7 @@ QString VApplication::VarToUser(const QString &var) const
|
||||||
|
|
||||||
QString newVar = var;
|
QString newVar = var;
|
||||||
int bias = 0;
|
int bias = 0;
|
||||||
if(VariablesToUser(newVar, 0, var, bias))
|
if (VariablesToUser(newVar, 0, var, bias))
|
||||||
{
|
{
|
||||||
return newVar;
|
return newVar;
|
||||||
}
|
}
|
||||||
|
@ -1682,22 +1682,22 @@ QString VApplication::VarFromUser(const QString &var) const
|
||||||
{
|
{
|
||||||
QString newVar = var;
|
QString newVar = var;
|
||||||
int bias = 0;
|
int bias = 0;
|
||||||
if(MeasurementsFromUser(newVar, 0, var, bias))
|
if (MeasurementsFromUser(newVar, 0, var, bias))
|
||||||
{
|
{
|
||||||
return newVar;
|
return newVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(VariablesFromUser(newVar, 0, var, bias))
|
if (VariablesFromUser(newVar, 0, var, bias))
|
||||||
{
|
{
|
||||||
return newVar;
|
return newVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PostfixOperatorsFromUser(newVar, 0, var, bias))
|
if (PostfixOperatorsFromUser(newVar, 0, var, bias))
|
||||||
{
|
{
|
||||||
return newVar;
|
return newVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FunctionsFromUser(newVar, 0, var, bias))
|
if (FunctionsFromUser(newVar, 0, var, bias))
|
||||||
{
|
{
|
||||||
return newVar;
|
return newVar;
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1737,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
|
||||||
for (int i = 0; i < tKeys.size(); ++i)
|
for (int i = 0; i < tKeys.size(); ++i)
|
||||||
{
|
{
|
||||||
int bias = 0;
|
int bias = 0;
|
||||||
if(MeasurementsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
if (MeasurementsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
||||||
{
|
{
|
||||||
if (bias != 0)
|
if (bias != 0)
|
||||||
{
|
{
|
||||||
|
@ -1748,7 +1748,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(VariablesFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
if (VariablesFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
||||||
{
|
{
|
||||||
if (bias != 0)
|
if (bias != 0)
|
||||||
{
|
{
|
||||||
|
@ -1759,7 +1759,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PostfixOperatorsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
if (PostfixOperatorsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
||||||
{
|
{
|
||||||
if (bias != 0)
|
if (bias != 0)
|
||||||
{
|
{
|
||||||
|
@ -1770,7 +1770,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FunctionsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
if (FunctionsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
||||||
{
|
{
|
||||||
if (bias != 0)
|
if (bias != 0)
|
||||||
{
|
{
|
||||||
|
@ -1787,7 +1787,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
|
||||||
bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
|
bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
|
||||||
|
|
||||||
QLocale loc = QLocale::system();
|
QLocale loc = QLocale::system();
|
||||||
if(loc != QLocale(QLocale::C) && osSeparatorValue)
|
if (loc != QLocale(QLocale::C) && osSeparatorValue)
|
||||||
{
|
{
|
||||||
QList<int> nKeys = numbers.keys();
|
QList<int> nKeys = numbers.keys();
|
||||||
QList<QString> nValues = numbers.values();
|
QList<QString> nValues = numbers.values();
|
||||||
|
@ -1889,7 +1889,7 @@ QString VApplication::FormulaToUser(const QString &formula)
|
||||||
}
|
}
|
||||||
|
|
||||||
int bias = 0;
|
int bias = 0;
|
||||||
if(VariablesToUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
if (VariablesToUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
||||||
{
|
{
|
||||||
if (bias != 0)
|
if (bias != 0)
|
||||||
{
|
{
|
||||||
|
@ -1906,7 +1906,7 @@ QString VApplication::FormulaToUser(const QString &formula)
|
||||||
bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
|
bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
|
||||||
|
|
||||||
QLocale loc = QLocale::system();
|
QLocale loc = QLocale::system();
|
||||||
if(loc != QLocale::C && osSeparatorValue)
|
if (loc != QLocale::C && osSeparatorValue)
|
||||||
{
|
{
|
||||||
QList<int> nKeys = numbers.keys();
|
QList<int> nKeys = numbers.keys();
|
||||||
QList<QString> nValues = numbers.values();
|
QList<QString> nValues = numbers.values();
|
||||||
|
@ -1915,12 +1915,12 @@ QString VApplication::FormulaToUser(const QString &formula)
|
||||||
QLocale loc = QLocale(QLocale::C);
|
QLocale loc = QLocale(QLocale::C);
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
qreal d = loc.toDouble(nValues.at(i), &ok);
|
qreal d = loc.toDouble(nValues.at(i), &ok);
|
||||||
if(ok == false)
|
if (ok == false)
|
||||||
{
|
{
|
||||||
qDebug()<<"Can't convert to double token"<<nValues.at(i);
|
qDebug()<<"Can't convert to double token"<<nValues.at(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(qFloor (d) < d)
|
if (qFloor (d) < d)
|
||||||
{
|
{
|
||||||
QLocale loc = QLocale::system();
|
QLocale loc = QLocale::system();
|
||||||
QString dStr = loc.toString(d);
|
QString dStr = loc.toString(d);
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1069,7 +1069,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1108,7 +1108,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1147,7 +1147,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1186,7 +1186,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1245,7 +1245,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1364,7 +1364,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating cut spline point"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating cut spline point"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1399,7 +1399,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating cut spline path point"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating cut spline path point"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1433,7 +1433,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1654,7 +1654,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement);
|
||||||
QString message("Message: " + e.GetMsg() + "\n"+
|
QString message("Message: " + e.GetMsg() + "\n"+
|
||||||
|
@ -1873,13 +1873,13 @@ void VPattern::GarbageCollector()
|
||||||
{
|
{
|
||||||
t.next();
|
t.next();
|
||||||
VDataTool *tool = t.value();
|
VDataTool *tool = t.value();
|
||||||
if(tool->referens() <= 1)
|
if (tool->referens() <= 1)
|
||||||
{
|
{
|
||||||
QDomElement domElement = elementById(QString().setNum(t.key()));
|
QDomElement domElement = elementById(QString().setNum(t.key()));
|
||||||
if(domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
QDomNode parent = domElement.parentNode();
|
QDomNode parent = domElement.parentNode();
|
||||||
if(parent.isNull() == false && parent.toElement().tagName() == TagModeling)
|
if (parent.isNull() == false && parent.toElement().tagName() == TagModeling)
|
||||||
{
|
{
|
||||||
parent.removeChild(domElement);
|
parent.removeChild(domElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,4 @@ inline QStringList VPattern::getPatternPieces() const
|
||||||
return patternPieces;
|
return patternPieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // VPATTERN_H
|
#endif // VPATTERN_H
|
||||||
|
|
|
@ -48,8 +48,7 @@ class QmuParserCallback
|
||||||
public:
|
public:
|
||||||
QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti);
|
QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti);
|
||||||
QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
|
QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
|
||||||
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity)
|
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity);
|
||||||
;
|
|
||||||
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti);
|
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti);
|
||||||
QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti);
|
QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti);
|
||||||
QmuParserCallback(fun_type4 a_pFun, bool a_bAllowOpti);
|
QmuParserCallback(fun_type4 a_pFun, bool a_bAllowOpti);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user