Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
949e1d9011
|
@ -245,7 +245,8 @@ qreal* Calculator::AddVariable(const QString &a_szName, void *a_pUserData)
|
||||||
*/
|
*/
|
||||||
void Calculator::SetSepForEval()
|
void Calculator::SetSepForEval()
|
||||||
{
|
{
|
||||||
SetArgSep(',');
|
SetArgSep(';');
|
||||||
|
SetThousandsSep(',');
|
||||||
SetDecSep('.');
|
SetDecSep('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,11 +113,11 @@ void VFormula::SetFormula(const QString &value, FormulaType type)
|
||||||
{
|
{
|
||||||
if (type == FormulaType::ToUser)
|
if (type == FormulaType::ToUser)
|
||||||
{
|
{
|
||||||
formula = value;
|
formula = qApp->FormulaToUser(value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
formula = qApp->FormulaToUser(value);
|
formula = value;
|
||||||
}
|
}
|
||||||
formula.replace("\n", " ");// Replace line return with spaces for calc if exist
|
formula.replace("\n", " ");// Replace line return with spaces for calc if exist
|
||||||
Eval();
|
Eval();
|
||||||
|
@ -239,17 +239,8 @@ void VFormula::Eval()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QLocale loc;
|
|
||||||
if (qApp->getSettings()->GetOsSeparator())
|
|
||||||
{
|
|
||||||
loc = QLocale::system();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
loc = QLocale(QLocale::C);
|
|
||||||
}
|
|
||||||
dValue = result;
|
dValue = result;
|
||||||
value = QString(loc.toString(result) + " " + postfix);
|
value = QString(qApp->LocaleToString(result) + " " + postfix);
|
||||||
_error = false;
|
_error = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "vmaingraphicsview.h"
|
#include "vmaingraphicsview.h"
|
||||||
#include "../container/calculator.h"
|
#include "../container/calculator.h"
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "vsettings.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "../options.h"
|
#include "../options.h"
|
||||||
#include "../widgets/vmaingraphicsview.h"
|
#include "../widgets/vmaingraphicsview.h"
|
||||||
#include "../../libs/qmuparser/qmutranslation.h"
|
#include "../../libs/qmuparser/qmutranslation.h"
|
||||||
|
#include "vsettings.h"
|
||||||
|
|
||||||
class VApplication;// used in define
|
class VApplication;// used in define
|
||||||
class QUndoStack;
|
class QUndoStack;
|
||||||
|
@ -40,7 +41,6 @@ class VMainGraphicsView;
|
||||||
class VMainGraphicsScene;
|
class VMainGraphicsScene;
|
||||||
class VPattern;
|
class VPattern;
|
||||||
class QFile;
|
class QFile;
|
||||||
class VSettings;
|
|
||||||
class QLockFile;
|
class QLockFile;
|
||||||
|
|
||||||
#if defined(qApp)
|
#if defined(qApp)
|
||||||
|
@ -81,8 +81,18 @@ public:
|
||||||
QString GuiText(const QString &measurement) const;
|
QString GuiText(const QString &measurement) const;
|
||||||
QString Description(const QString &measurement) const;
|
QString Description(const QString &measurement) const;
|
||||||
QString PostfixOperator(const QString &name) const;
|
QString PostfixOperator(const QString &name) const;
|
||||||
|
|
||||||
QString FormulaFromUser(const QString &formula);
|
QString FormulaFromUser(const QString &formula);
|
||||||
QString FormulaToUser(const QString &formula);
|
QString FormulaToUser(const QString &formula);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
QString LocaleToString(const T &value)
|
||||||
|
{
|
||||||
|
QLocale loc;
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
|
||||||
|
return loc.toString(value);
|
||||||
|
}
|
||||||
|
|
||||||
QUndoStack *getUndoStack() const;
|
QUndoStack *getUndoStack() const;
|
||||||
VMainGraphicsView *getSceneView() const;
|
VMainGraphicsView *getSceneView() const;
|
||||||
void setSceneView(VMainGraphicsView *value);
|
void setSceneView(VMainGraphicsView *value);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include "../core/vapplication.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent) :
|
ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
|
@ -93,6 +94,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
|
|
||||||
this->setFixedSize(QSize(750, 550));
|
this->setFixedSize(QSize(750, 550));
|
||||||
this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
|
this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -156,6 +158,8 @@ void ConfigDialog::Apply()
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
emit UpdateProperties();
|
||||||
setResult(QDialog::Accepted);
|
setResult(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@ public:
|
||||||
explicit ConfigDialog(QWidget *parent = nullptr);
|
explicit ConfigDialog(QWidget *parent = nullptr);
|
||||||
public slots:
|
public slots:
|
||||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
signals:
|
||||||
|
void UpdateProperties();
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "../../options.h"
|
#include "../../options.h"
|
||||||
|
#include "../core/vapplication.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
|
@ -41,6 +42,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION));
|
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION));
|
||||||
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
||||||
ui->label_QT_Version->setText(buildCompatibilityString());
|
ui->label_QT_Version->setText(buildCompatibilityString());
|
||||||
|
|
|
@ -49,6 +49,9 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
|
||||||
cursorToolRecordRow(0)
|
cursorToolRecordRow(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
||||||
FillTable();
|
FillTable();
|
||||||
|
@ -197,7 +200,7 @@ void DialogHistory::FillTable()
|
||||||
*/
|
*/
|
||||||
QString DialogHistory::Record(const VToolRecord &tool)
|
QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
{
|
{
|
||||||
const QDomElement domElem = doc->elementById(QString().setNum(tool.getId()));
|
const QDomElement domElem = doc->elementById(tool.getId());
|
||||||
if (domElem.isElement() == false)
|
if (domElem.isElement() == false)
|
||||||
{
|
{
|
||||||
qDebug()<<"Can't find element by id"<<Q_FUNC_INFO;
|
qDebug()<<"Can't find element by id"<<Q_FUNC_INFO;
|
||||||
|
|
|
@ -55,6 +55,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
qCDebug(vDialog)<<"Showing variables.";
|
qCDebug(vDialog)<<"Showing variables.";
|
||||||
if (qApp->patternType() == MeasurementsType::Individual)
|
if (qApp->patternType() == MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
|
@ -177,14 +179,14 @@ void DialogIncrements::FillMeasurements()
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString()
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->LocaleToString(
|
||||||
.setNum(data->GetTableValue(qApp->VarFromUser(iMap.key()))));
|
data->GetTableValue(qApp->VarFromUser(iMap.key()))));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
SetItemViewOnly(item);
|
SetItemViewOnly(item);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);// calculated value
|
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);// calculated value
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(m->GetBase()));
|
item = new QTableWidgetItem(qApp->LocaleToString(m->GetBase()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
|
@ -194,12 +196,12 @@ void DialogIncrements::FillMeasurements()
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m->GetKsize()));
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->LocaleToString(m->GetKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
SetItemViewOnly(item);
|
SetItemViewOnly(item);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);// in sizes
|
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);// in sizes
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(m->GetKheight()));
|
item = new QTableWidgetItem(qApp->LocaleToString(m->GetKheight()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
SetItemViewOnly(item);
|
SetItemViewOnly(item);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);// in heights
|
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);// in heights
|
||||||
|
@ -250,23 +252,23 @@ void DialogIncrements::FillIncrements()
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
item = new QTableWidgetItem(QString().setNum(data->GetTableValue(iMap.value())));
|
item = new QTableWidgetItem(qApp->LocaleToString(data->GetTableValue(iMap.value())));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
SetItemViewOnly(item);
|
SetItemViewOnly(item);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(incr->GetBase()));
|
item = new QTableWidgetItem(qApp->LocaleToString(incr->GetBase()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
item = new QTableWidgetItem(QString().setNum(incr->GetKsize()));
|
item = new QTableWidgetItem(qApp->LocaleToString(incr->GetKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(incr->GetKheight()));
|
item = new QTableWidgetItem(qApp->LocaleToString(incr->GetKheight()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +307,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> varTable, QTableWidget *
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
table->setItem(currentRow, 0, item);
|
table->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(length));
|
item = new QTableWidgetItem(qApp->LocaleToString(length));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
table->setItem(currentRow, 1, item);
|
table->setItem(currentRow, 1, item);
|
||||||
}
|
}
|
||||||
|
@ -676,7 +678,7 @@ void DialogIncrements::clickedToolButtonRemove()
|
||||||
data->RemoveIncrement(itemName->text());
|
data->RemoveIncrement(itemName->text());
|
||||||
|
|
||||||
quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
|
quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
|
QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
|
||||||
|
@ -748,7 +750,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
|
||||||
const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
|
const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
|
||||||
const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column);
|
const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column);
|
||||||
const quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
|
const quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
{
|
{
|
||||||
qCDebug(vDialog)<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO;
|
qCDebug(vDialog)<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO;
|
||||||
|
|
|
@ -47,6 +47,8 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
QRect position = this->frameGeometry();
|
QRect position = this->frameGeometry();
|
||||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||||
move(position.topLeft());
|
move(position.topLeft());
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "dialoglayoutprogress.h"
|
#include "dialoglayoutprogress.h"
|
||||||
#include "ui_dialoglayoutprogress.h"
|
#include "ui_dialoglayoutprogress.h"
|
||||||
#include "../options.h"
|
#include "../options.h"
|
||||||
|
#include "../core/vapplication.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -38,6 +39,9 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
|
||||||
:QDialog(parent), ui(new Ui::DialogLayoutProgress)
|
:QDialog(parent), ui(new Ui::DialogLayoutProgress)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ui->progressBar->setMaximum(count);
|
ui->progressBar->setMaximum(count);
|
||||||
ui->progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,9 @@ DialogLayoutSettings::DialogLayoutSettings(QWidget *parent)
|
||||||
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm)
|
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
InitPaperUnits();
|
InitPaperUnits();
|
||||||
InitLayoutUnits();
|
InitLayoutUnits();
|
||||||
InitTemplates();
|
InitTemplates();
|
||||||
|
|
|
@ -28,12 +28,16 @@
|
||||||
|
|
||||||
#include "dialogmeasurements.h"
|
#include "dialogmeasurements.h"
|
||||||
#include "ui_dialogmeasurements.h"
|
#include "ui_dialogmeasurements.h"
|
||||||
|
#include "../core/vapplication.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
||||||
QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual)
|
QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
|
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
|
||||||
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
|
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
|
||||||
|
|
||||||
SCASSERT(doc != nullptr);
|
SCASSERT(doc != nullptr);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
ui->lineEditAuthor->setText(doc->GetAuthor());
|
ui->lineEditAuthor->setText(doc->GetAuthor());
|
||||||
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "dialogpatternxmledit.h"
|
#include "dialogpatternxmledit.h"
|
||||||
#include "ui_dialogpatternxmledit.h"
|
#include "ui_dialogpatternxmledit.h"
|
||||||
|
#include "../core/vapplication.h"
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -36,7 +37,6 @@ const short int DialogPatternXmlEdit::ChangeTypeDelete=1;
|
||||||
const short int DialogPatternXmlEdit::ChangeTypeAdd=2;
|
const short int DialogPatternXmlEdit::ChangeTypeAdd=2;
|
||||||
const short int DialogPatternXmlEdit::ChangeTypeModify=3;
|
const short int DialogPatternXmlEdit::ChangeTypeModify=3;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
|
DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
|
||||||
:QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0),
|
:QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0),
|
||||||
|
@ -46,6 +46,8 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
this->xmlmodel = new VXMLTreeView();
|
this->xmlmodel = new VXMLTreeView();
|
||||||
this->doc=xmldoc;
|
this->doc=xmldoc;
|
||||||
this->root = this->doc->documentElement();
|
this->root = this->doc->documentElement();
|
||||||
|
|
|
@ -43,6 +43,8 @@ DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int c
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
SCASSERT(bOk != nullptr);
|
SCASSERT(bOk != nullptr);
|
||||||
bOk->setEnabled(false);
|
bOk->setEnabled(false);
|
||||||
|
|
|
@ -46,6 +46,8 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
QRect position = this->frameGeometry();
|
QRect position = this->frameGeometry();
|
||||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||||
move(position.topLeft());
|
move(position.topLeft());
|
||||||
|
|
|
@ -39,6 +39,8 @@ DialogUndo::DialogUndo(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
bool opening = qApp->getOpeningPattern();
|
bool opening = qApp->getOpeningPattern();
|
||||||
if (opening)
|
if (opening)
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,7 +191,7 @@ void DialogArc::SetF1(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogArc::SetRadius(const QString &value)
|
void DialogArc::SetRadius(const QString &value)
|
||||||
{
|
{
|
||||||
radius = value;
|
radius = qApp->FormulaToUser(value);
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (radius.length() > 80)
|
if (radius.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -443,7 +443,7 @@ quint32 DialogArc::GetCenter() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetRadius() const
|
QString DialogArc::GetRadius() const
|
||||||
{
|
{
|
||||||
return radius;
|
return qApp->FormulaFromUser(radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -453,7 +453,7 @@ QString DialogArc::GetRadius() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetF1() const
|
QString DialogArc::GetF1() const
|
||||||
{
|
{
|
||||||
return f1;
|
return qApp->FormulaFromUser(f1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -463,5 +463,5 @@ QString DialogArc::GetF1() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetF2() const
|
QString DialogArc::GetF2() const
|
||||||
{
|
{
|
||||||
return f2;
|
return qApp->FormulaFromUser(f2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ void DialogPointOfContact::setCenter(const quint32 &value)
|
||||||
*/
|
*/
|
||||||
void DialogPointOfContact::setRadius(const QString &value)
|
void DialogPointOfContact::setRadius(const QString &value)
|
||||||
{
|
{
|
||||||
radius = value;
|
radius = qApp->FormulaToUser(value);
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (radius.length() > 80)
|
if (radius.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -300,7 +300,7 @@ void DialogPointOfContact::SetPointName(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogPointOfContact::getRadius() const
|
QString DialogPointOfContact::getRadius() const
|
||||||
{
|
{
|
||||||
return radius;
|
return qApp->FormulaFromUser(radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include "../../geometry/vsplinepath.h"
|
#include "../../geometry/vsplinepath.h"
|
||||||
#include "../../tools/vabstracttool.h"
|
#include "../../tools/vabstracttool.h"
|
||||||
#include "../../../libs/qmuparser/qmuparsererror.h"
|
#include "../../../libs/qmuparser/qmuparsererror.h"
|
||||||
#include "../../core/vapplication.h"
|
|
||||||
#include "../../core/vsettings.h"
|
|
||||||
#include "../../libs/ifc/xml/vdomdocument.h"
|
#include "../../libs/ifc/xml/vdomdocument.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
@ -502,16 +500,7 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QLocale loc;
|
label->setText(qApp->LocaleToString(result) + " " +postfix);
|
||||||
if (qApp->getSettings()->GetOsSeparator())
|
|
||||||
{
|
|
||||||
loc = QLocale::system();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
loc = QLocale(QLocale::C);
|
|
||||||
}
|
|
||||||
label->setText(loc.toString(result) + " " +postfix);
|
|
||||||
flag = true;
|
flag = true;
|
||||||
ChangeColor(labelEditFormula, okColor);
|
ChangeColor(labelEditFormula, okColor);
|
||||||
label->setToolTip(tr("Value"));
|
label->setToolTip(tr("Value"));
|
||||||
|
|
|
@ -321,6 +321,8 @@ protected:
|
||||||
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
SCASSERT(bCancel != nullptr);
|
SCASSERT(bCancel != nullptr);
|
||||||
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -134,6 +134,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
PropertyBrowser();
|
PropertyBrowser();
|
||||||
|
|
||||||
setCurrentFile("");
|
setCurrentFile("");
|
||||||
|
WindowsLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1143,6 +1144,7 @@ void MainWindow::ArrowTool()
|
||||||
ui->actionArrowTool->setChecked(true);
|
ui->actionArrowTool->setChecked(true);
|
||||||
ui->actionStopTool->setEnabled(false);
|
ui->actionStopTool->setEnabled(false);
|
||||||
tool = Tool::Arrow;
|
tool = Tool::Arrow;
|
||||||
|
emit EnableItemMove(true);
|
||||||
QCursor cur(Qt::ArrowCursor);
|
QCursor cur(Qt::ArrowCursor);
|
||||||
ui->view->setCursor(cur);
|
ui->view->setCursor(cur);
|
||||||
helpLabel->setText("");
|
helpLabel->setText("");
|
||||||
|
@ -1402,6 +1404,8 @@ void MainWindow::Open()
|
||||||
void MainWindow::Preferences()
|
void MainWindow::Preferences()
|
||||||
{
|
{
|
||||||
ConfigDialog dlg(this);
|
ConfigDialog dlg(this);
|
||||||
|
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
|
||||||
|
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
|
||||||
if (dlg.exec() == QDialog::Accepted)
|
if (dlg.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
InitAutoSave();
|
InitAutoSave();
|
||||||
|
@ -2473,6 +2477,12 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
||||||
return restoreFiles;
|
return restoreFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::WindowsLocale()
|
||||||
|
{
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,6 +130,7 @@ public slots:
|
||||||
void Layout();
|
void Layout();
|
||||||
void UpdateGradation();
|
void UpdateGradation();
|
||||||
void GlobalChangePP(const QString &patternPiece);
|
void GlobalChangePP(const QString &patternPiece);
|
||||||
|
void WindowsLocale();
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief ModelChosen emit after calculation all details.
|
* @brief ModelChosen emit after calculation all details.
|
||||||
|
|
|
@ -60,6 +60,9 @@ TableWindow::TableWindow(QWidget *parent)
|
||||||
description(QString()), tempScene(nullptr)
|
description(QString()), tempScene(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
tempScene = new QGraphicsScene(QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm)));
|
tempScene = new QGraphicsScene(QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm)));
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
brush.setStyle( Qt::SolidPattern );
|
brush.setStyle( Qt::SolidPattern );
|
||||||
|
|
|
@ -114,7 +114,7 @@ void VDrawTool::FullUpdateFromGuiApply()
|
||||||
void VDrawTool::SaveDialogChange()
|
void VDrawTool::SaveDialogChange()
|
||||||
{
|
{
|
||||||
qCDebug(vTool)<<"Saving tool options after using dialog";
|
qCDebug(vTool)<<"Saving tool options after using dialog";
|
||||||
QDomElement oldDomElement = doc->elementById(QString().setNum(id));
|
QDomElement oldDomElement = doc->elementById(id);
|
||||||
if (oldDomElement.isElement())
|
if (oldDomElement.isElement())
|
||||||
{
|
{
|
||||||
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
|
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
|
||||||
|
@ -148,7 +148,7 @@ void VDrawTool::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VDrawTool::RefreshDataInFile()
|
void VDrawTool::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||||
|
@ -176,7 +176,7 @@ QColor VDrawTool::CorrectColor(const QColor &color) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDrawTool::ReadAttributes()
|
void VDrawTool::ReadAttributes()
|
||||||
{
|
{
|
||||||
const QDomElement domElement = doc->elementById(QString().setNum(id));
|
const QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
ReadToolAttributes(domElement);
|
ReadToolAttributes(domElement);
|
||||||
|
|
|
@ -146,7 +146,7 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(attrCurve.isEmpty() == false, Q_FUNC_INFO, "attribute name is empty");
|
Q_ASSERT_X(attrCurve.isEmpty() == false, Q_FUNC_INFO, "attribute name is empty");
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formula = domElement.attribute(AttrLength, "");
|
||||||
|
|
|
@ -275,7 +275,7 @@ void VToolLine::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VToolLine::RefreshDataInFile()
|
void VToolLine::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = QSharedPointer<VGObject> ();
|
QSharedPointer<VGObject> obj = QSharedPointer<VGObject> ();
|
||||||
|
|
|
@ -335,7 +335,7 @@ void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
*/
|
*/
|
||||||
void VToolSplinePath::RefreshDataInFile()
|
void VToolSplinePath::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
{
|
{
|
||||||
qDebug()<<"Can't find element with id="<<id<<"in pattern file";
|
qDebug()<<"Can't find element with id="<<id<<"in pattern file";
|
||||||
|
|
|
@ -99,7 +99,7 @@ void VAbstractNode::decrementReferens()
|
||||||
if (_referens <= 0)
|
if (_referens <= 0)
|
||||||
{
|
{
|
||||||
doc->DecrementReferens(idNode);
|
doc->DecrementReferens(idNode);
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
QDomNode element = domElement.parentNode();
|
QDomNode element = domElement.parentNode();
|
||||||
|
|
|
@ -164,7 +164,7 @@ void VNodeArc::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VNodeArc::RefreshDataInFile()
|
void VNodeArc::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
|
|
|
@ -180,7 +180,7 @@ void VNodePoint::AddToFile()
|
||||||
void VNodePoint::RefreshDataInFile()
|
void VNodePoint::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
|
@ -253,7 +253,7 @@ void VNodePoint::NameChangePosition(const QPointF &pos)
|
||||||
*/
|
*/
|
||||||
void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
|
void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(mx)));
|
doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(mx)));
|
||||||
|
|
|
@ -167,7 +167,7 @@ void VNodeSpline::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VNodeSpline::RefreshDataInFile()
|
void VNodeSpline::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
||||||
|
|
|
@ -170,7 +170,7 @@ void VNodeSplinePath::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VNodeSplinePath::RefreshDataInFile()
|
void VNodeSplinePath::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
||||||
|
|
|
@ -310,7 +310,7 @@ int VAbstractTool::ConfirmDeletion()
|
||||||
void VAbstractTool::SaveOption(QSharedPointer<VGObject> &obj)
|
void VAbstractTool::SaveOption(QSharedPointer<VGObject> &obj)
|
||||||
{
|
{
|
||||||
qCDebug(vTool)<<"Saving tool options";
|
qCDebug(vTool)<<"Saving tool options";
|
||||||
QDomElement oldDomElement = doc->elementById(QString().setNum(id));
|
QDomElement oldDomElement = doc->elementById(id);
|
||||||
if (oldDomElement.isElement())
|
if (oldDomElement.isElement())
|
||||||
{
|
{
|
||||||
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
|
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
|
||||||
|
|
|
@ -304,7 +304,7 @@ void VToolDetail::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VToolDetail::RefreshDataInFile()
|
void VToolDetail::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
VDetail det = VAbstractTool::data.GetDetail(id);
|
VDetail det = VAbstractTool::data.GetDetail(id);
|
||||||
|
|
|
@ -750,7 +750,7 @@ void VToolUnionDetails::AddToFile()
|
||||||
*/
|
*/
|
||||||
void VToolUnionDetails::RefreshDataInFile()
|
void VToolUnionDetails::RefreshDataInFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrIndexD1, indexD1);
|
doc->SetAttribute(domElement, AttrIndexD1, indexD1);
|
||||||
|
|
|
@ -50,7 +50,7 @@ void AddDet::undo()
|
||||||
QDomElement element;
|
QDomElement element;
|
||||||
if (doc->GetActivNodeElement(VPattern::TagDetails, element))
|
if (doc->GetActivNodeElement(VPattern::TagDetails, element))
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
if (element.removeChild(domElement).isNull())
|
if (element.removeChild(domElement).isNull())
|
||||||
|
|
|
@ -49,7 +49,7 @@ void AddDetNode::undo()
|
||||||
QDomElement modelingElement;
|
QDomElement modelingElement;
|
||||||
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
|
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
if (modelingElement.removeChild(domElement).isNull())
|
if (modelingElement.removeChild(domElement).isNull())
|
||||||
|
|
|
@ -56,7 +56,7 @@ void AddToCalc::undo()
|
||||||
QDomElement calcElement;
|
QDomElement calcElement;
|
||||||
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement))
|
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement))
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
if (calcElement.removeChild(domElement).isNull())
|
if (calcElement.removeChild(domElement).isNull())
|
||||||
|
@ -102,7 +102,7 @@ void AddToCalc::redo()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QDomElement refElement = doc->elementById(QString().setNum(cursor));
|
QDomElement refElement = doc->elementById(cursor);
|
||||||
if (refElement.isElement())
|
if (refElement.isElement())
|
||||||
{
|
{
|
||||||
calcElement.insertAfter(xml, refElement);
|
calcElement.insertAfter(xml, refElement);
|
||||||
|
|
|
@ -49,7 +49,7 @@ void AddUnionDetails::undo()
|
||||||
QDomElement modelingElement;
|
QDomElement modelingElement;
|
||||||
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
|
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
if (modelingElement.removeChild(domElement).isNull())
|
if (modelingElement.removeChild(domElement).isNull())
|
||||||
|
|
|
@ -36,7 +36,7 @@ DeleteDetail::DeleteDetail(VPattern *doc, quint32 id, QUndoCommand *parent)
|
||||||
{
|
{
|
||||||
setText(tr("Delete tool"));
|
setText(tr("Delete tool"));
|
||||||
nodeId = id;
|
nodeId = id;
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
xml = domElement.cloneNode().toElement();
|
xml = domElement.cloneNode().toElement();
|
||||||
|
@ -77,7 +77,7 @@ void DeleteDetail::redo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Redo.";
|
qCDebug(vUndo)<<"Redo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
parentNode.removeChild(domElement);
|
parentNode.removeChild(domElement);
|
||||||
|
|
|
@ -42,7 +42,7 @@ MoveDetail::MoveDetail(VPattern *doc, const double &x, const double &y, const qu
|
||||||
nodeId = id;
|
nodeId = id;
|
||||||
|
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
oldX = qApp->toPixel(doc->GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"));
|
oldX = qApp->toPixel(doc->GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"));
|
||||||
|
@ -64,7 +64,7 @@ void MoveDetail::undo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Undo.";
|
qCDebug(vUndo)<<"Undo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
SaveCoordinates(domElement, oldX, oldY);
|
SaveCoordinates(domElement, oldX, oldY);
|
||||||
|
@ -86,7 +86,7 @@ void MoveDetail::redo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Redo.";
|
qCDebug(vUndo)<<"Redo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
SaveCoordinates(domElement, newX, newY);
|
SaveCoordinates(domElement, newX, newY);
|
||||||
|
|
|
@ -46,7 +46,7 @@ MoveLabel::MoveLabel(VPattern *doc, const double &x, const double &y, const quin
|
||||||
qCDebug(vUndo)<<"Label new My"<<newMy;
|
qCDebug(vUndo)<<"Label new My"<<newMy;
|
||||||
|
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
oldMx = qApp->toPixel(doc->GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"));
|
oldMx = qApp->toPixel(doc->GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"));
|
||||||
|
@ -114,7 +114,7 @@ void MoveLabel::Do(double mx, double my)
|
||||||
qCDebug(vUndo)<<"New mx"<<mx;
|
qCDebug(vUndo)<<"New mx"<<mx;
|
||||||
qCDebug(vUndo)<<"New my"<<my;
|
qCDebug(vUndo)<<"New my"<<my;
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, VAbstractTool::AttrMx, QString().setNum(qApp->fromPixel(mx)));
|
doc->SetAttribute(domElement, VAbstractTool::AttrMx, QString().setNum(qApp->fromPixel(mx)));
|
||||||
|
|
|
@ -88,7 +88,7 @@ int MoveSpline::id() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MoveSpline::Do(const VSpline &spl)
|
void MoveSpline::Do(const VSpline &spl)
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(spl.GetAngle1()));
|
doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(spl.GetAngle1()));
|
||||||
|
|
|
@ -86,7 +86,7 @@ int MoveSplinePath::id() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MoveSplinePath::Do(const VSplinePath &splPath)
|
void MoveSplinePath::Do(const VSplinePath &splPath)
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(splPath.GetKCurve()));
|
doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(splPath.GetKCurve()));
|
||||||
|
|
|
@ -46,7 +46,7 @@ MoveSPoint::MoveSPoint(VPattern *doc, const double &x, const double &y, const qu
|
||||||
qCDebug(vUndo)<<"SPoint newY"<<newY;
|
qCDebug(vUndo)<<"SPoint newY"<<newY;
|
||||||
|
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
oldX = qApp->toPixel(doc->GetParametrDouble(domElement, VAbstractTool::AttrX, "0.0"));
|
oldX = qApp->toPixel(doc->GetParametrDouble(domElement, VAbstractTool::AttrX, "0.0"));
|
||||||
|
@ -114,7 +114,7 @@ void MoveSPoint::Do(double x, double y)
|
||||||
qCDebug(vUndo)<<"Move to x"<<x;
|
qCDebug(vUndo)<<"Move to x"<<x;
|
||||||
qCDebug(vUndo)<<"Move to y"<<y;
|
qCDebug(vUndo)<<"Move to y"<<y;
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, VAbstractTool::AttrX, QString().setNum(qApp->fromPixel(x)));
|
doc->SetAttribute(domElement, VAbstractTool::AttrX, QString().setNum(qApp->fromPixel(x)));
|
||||||
|
|
|
@ -48,7 +48,7 @@ void SaveDetailOptions::undo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Undo.";
|
qCDebug(vUndo)<<"Undo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
SaveDet(domElement, oldDet);
|
SaveDet(domElement, oldDet);
|
||||||
|
@ -85,7 +85,7 @@ void SaveDetailOptions::redo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Redo.";
|
qCDebug(vUndo)<<"Redo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
SaveDet(domElement, newDet);
|
SaveDet(domElement, newDet);
|
||||||
|
|
|
@ -48,7 +48,7 @@ void SaveToolOptions::undo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Undo.";
|
qCDebug(vUndo)<<"Undo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.parentNode().replaceChild(oldXml, domElement);
|
domElement.parentNode().replaceChild(oldXml, domElement);
|
||||||
|
@ -67,7 +67,7 @@ void SaveToolOptions::redo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo)<<"Redo.";
|
qCDebug(vUndo)<<"Redo.";
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.parentNode().replaceChild(newXml, domElement);
|
domElement.parentNode().replaceChild(newXml, domElement);
|
||||||
|
|
|
@ -53,6 +53,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
emit NewLastValue(-10001.0);//Here need reset value to default because we begin work with new item
|
emit NewLastValue(-10001.0);//Here need reset value to default because we begin work with new item
|
||||||
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
||||||
|
editor->setLocale(parent->locale());
|
||||||
editor->setMinimum(-10000.0);
|
editor->setMinimum(-10000.0);
|
||||||
editor->setMaximum(10000.0);
|
editor->setMaximum(10000.0);
|
||||||
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
||||||
|
|
|
@ -58,6 +58,7 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
QLineEdit *editor = new QLineEdit(parent);
|
QLineEdit *editor = new QLineEdit(parent);
|
||||||
|
editor->setLocale(parent->locale());
|
||||||
//Same regex pattern in xsd file
|
//Same regex pattern in xsd file
|
||||||
editor->setValidator( new QRegExpValidator(QRegExp(regex)) );
|
editor->setValidator( new QRegExpValidator(QRegExp(regex)) );
|
||||||
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
||||||
|
|
|
@ -94,7 +94,7 @@ QWidget* VFormulaProperty::createEditor(QWidget* parent, const QStyleOptionViewI
|
||||||
|
|
||||||
VFormula formula = VProperty::d_ptr->VariantValue.value<VFormula>();
|
VFormula formula = VProperty::d_ptr->VariantValue.value<VFormula>();
|
||||||
VFormulaPropertyEditor* tmpEditor = new VFormulaPropertyEditor(parent);
|
VFormulaPropertyEditor* tmpEditor = new VFormulaPropertyEditor(parent);
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->SetFormula(formula);
|
tmpEditor->SetFormula(formula);
|
||||||
VProperty::d_ptr->editor = tmpEditor;
|
VProperty::d_ptr->editor = tmpEditor;
|
||||||
return VProperty::d_ptr->editor;
|
return VProperty::d_ptr->editor;
|
||||||
|
|
|
@ -232,6 +232,14 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolOptionsPropertyBrowser::RefreshOptions()
|
||||||
|
{
|
||||||
|
QGraphicsItem *item = currentItem;
|
||||||
|
itemClicked(nullptr);//close options
|
||||||
|
itemClicked(item);//reopen options
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@ public slots:
|
||||||
void itemClicked(QGraphicsItem *item);
|
void itemClicked(QGraphicsItem *item);
|
||||||
void userChangedData(VPE::VProperty* property);
|
void userChangedData(VPE::VProperty* property);
|
||||||
void UpdateOptions();
|
void UpdateOptions();
|
||||||
|
void RefreshOptions();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolOptionsPropertyBrowser)
|
Q_DISABLE_COPY(VToolOptionsPropertyBrowser)
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,12 @@ QDomElement VDomDocument::elementById(const QString& id)
|
||||||
return QDomElement();
|
return QDomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QDomElement VDomDocument::elementById(quint32 id)
|
||||||
|
{
|
||||||
|
return elementById(QString().setNum(id));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Removes all children of a given element tag. RENAME: removeAllChildren
|
* @brief Removes all children of a given element tag. RENAME: removeAllChildren
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
VDomDocument();
|
VDomDocument();
|
||||||
virtual ~VDomDocument();
|
virtual ~VDomDocument();
|
||||||
QDomElement elementById(const QString& id);
|
QDomElement elementById(const QString& id);
|
||||||
|
QDomElement elementById(quint32 id);
|
||||||
void removeAllChilds(QDomElement &element);
|
void removeAllChilds(QDomElement &element);
|
||||||
template <typename T>
|
template <typename T>
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -199,14 +199,14 @@ qreal QmuParser::Max(const qreal *a_afArg, int a_iArgc)
|
||||||
* @param [out] a_fVal Pointer where the value should be stored in case one is found.
|
* @param [out] a_fVal Pointer where the value should be stored in case one is found.
|
||||||
* @return 1 if a value was found 0 otherwise.
|
* @return 1 if a value was found 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int QmuParser::IsVal(const QString &a_szExpr, int *a_iPos, qreal *a_fVal)
|
int QmuParser::IsVal(const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const std::locale &s_locale)
|
||||||
{
|
{
|
||||||
qreal fVal(0);
|
qreal fVal(0);
|
||||||
|
|
||||||
std::wstring a_szExprStd = a_szExpr.toStdWString();
|
std::wstring a_szExprStd = a_szExpr.toStdWString();
|
||||||
stringstream_type stream(a_szExprStd);
|
stringstream_type stream(a_szExprStd);
|
||||||
stream.seekg(0); // todo: check if this really is necessary
|
stream.seekg(0); // todo: check if this really is necessary
|
||||||
stream.imbue(QmuParser::s_locale);
|
stream.imbue(s_locale);
|
||||||
stream >> fVal;
|
stream >> fVal;
|
||||||
stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading
|
stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace qmu
|
||||||
virtual void OnDetectVar(const QString &pExpr, int &nStart, int &nEnd);
|
virtual void OnDetectVar(const QString &pExpr, int &nStart, int &nEnd);
|
||||||
qreal Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const;
|
qreal Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const;
|
||||||
protected:
|
protected:
|
||||||
static int IsVal(const QString &a_szExpr, int *a_iPos, qreal *a_fVal);
|
static int IsVal(const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const std::locale &s_locale);
|
||||||
// Trigonometric functions
|
// Trigonometric functions
|
||||||
static qreal Tan2(qreal, qreal);
|
static qreal Tan2(qreal, qreal);
|
||||||
// hyperbolic functions
|
// hyperbolic functions
|
||||||
|
|
|
@ -37,7 +37,6 @@ using namespace std;
|
||||||
|
|
||||||
namespace qmu
|
namespace qmu
|
||||||
{
|
{
|
||||||
std::locale QmuParserBase::s_locale = std::locale(std::locale::classic(), new change_dec_sep<char_type>('.'));
|
|
||||||
|
|
||||||
bool QmuParserBase::g_DbgDumpCmdCode = false;
|
bool QmuParserBase::g_DbgDumpCmdCode = false;
|
||||||
bool QmuParserBase::g_DbgDumpStack = false;
|
bool QmuParserBase::g_DbgDumpStack = false;
|
||||||
|
@ -57,7 +56,8 @@ const QStringList QmuParserBase::c_DefaultOprt = QStringList()<< "<=" << ">=" <<
|
||||||
* @brief Constructor.
|
* @brief Constructor.
|
||||||
*/
|
*/
|
||||||
QmuParserBase::QmuParserBase()
|
QmuParserBase::QmuParserBase()
|
||||||
:m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(),
|
:s_locale(std::locale(std::locale::classic(), new change_dec_sep<char_type>('.'))),
|
||||||
|
m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(),
|
||||||
m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(),
|
m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(),
|
||||||
m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(),
|
m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(),
|
||||||
m_nFinalResultIdx(0), m_Tokens(QMap<int, QString>()), m_Numbers(QMap<int, QString>()), allowSubexpressions(true)
|
m_nFinalResultIdx(0), m_Tokens(QMap<int, QString>()), m_Numbers(QMap<int, QString>()), allowSubexpressions(true)
|
||||||
|
@ -72,10 +72,11 @@ QmuParserBase::QmuParserBase()
|
||||||
* Tha parser can be safely copy constructed but the bytecode is reset during copy construction.
|
* Tha parser can be safely copy constructed but the bytecode is reset during copy construction.
|
||||||
*/
|
*/
|
||||||
QmuParserBase::QmuParserBase(const QmuParserBase &a_Parser)
|
QmuParserBase::QmuParserBase(const QmuParserBase &a_Parser)
|
||||||
:m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(),
|
:s_locale(a_Parser.getLocale()), m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(),
|
||||||
m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(),
|
m_vStringVarBuf(), m_pTokenReader(), m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(),
|
||||||
m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(),
|
m_StrVarDef(), m_VarDef(), m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(),
|
||||||
m_nFinalResultIdx(0), m_Tokens(QMap<int, QString>()), m_Numbers(QMap<int, QString>()), allowSubexpressions(true)
|
m_nIfElseCounter(0), m_vStackBuffer(), m_nFinalResultIdx(0), m_Tokens(QMap<int, QString>()),
|
||||||
|
m_Numbers(QMap<int, QString>()), allowSubexpressions(true)
|
||||||
{
|
{
|
||||||
m_pTokenReader.reset(new token_reader_type(this));
|
m_pTokenReader.reset(new token_reader_type(this));
|
||||||
Assign(a_Parser);
|
Assign(a_Parser);
|
||||||
|
@ -220,6 +221,18 @@ void QmuParserBase::setAllowSubexpressions(bool value)
|
||||||
allowSubexpressions = value;
|
allowSubexpressions = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
std::locale QmuParserBase::getLocale() const
|
||||||
|
{
|
||||||
|
return s_locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void QmuParserBase::setLocale(const std::locale &value)
|
||||||
|
{
|
||||||
|
s_locale = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Returns the version of muparser.
|
* @brief Returns the version of muparser.
|
||||||
|
@ -1300,7 +1313,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
opt = m_pTokenReader->ReadNextToken();
|
opt = m_pTokenReader->ReadNextToken(s_locale);
|
||||||
|
|
||||||
switch (opt.GetCode())
|
switch (opt.GetCode())
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,9 +122,12 @@ public:
|
||||||
}
|
}
|
||||||
void setAllowSubexpressions(bool value);
|
void setAllowSubexpressions(bool value);
|
||||||
|
|
||||||
|
std::locale getLocale() const;
|
||||||
|
void setLocale(const std::locale &value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const QStringList c_DefaultOprt;
|
static const QStringList c_DefaultOprt;
|
||||||
static std::locale s_locale; ///< The locale used by the parser
|
std::locale s_locale; ///< The locale used by the parser
|
||||||
static bool g_DbgDumpCmdCode;
|
static bool g_DbgDumpCmdCode;
|
||||||
static bool g_DbgDumpStack;
|
static bool g_DbgDumpStack;
|
||||||
void Init();
|
void Init();
|
||||||
|
|
|
@ -275,7 +275,7 @@ typedef qreal ( *strfun_type2 ) ( const QString &, qreal );
|
||||||
typedef qreal ( *strfun_type3 ) ( const QString &, qreal, qreal );
|
typedef qreal ( *strfun_type3 ) ( const QString &, qreal, qreal );
|
||||||
|
|
||||||
/** @brief Callback used for functions that identify values in a string. */
|
/** @brief Callback used for functions that identify values in a string. */
|
||||||
typedef int ( *identfun_type ) ( const QString &sExpr, int *nPos, qreal *fVal );
|
typedef int ( *identfun_type ) ( const QString &sExpr, int *nPos, qreal *fVal, const std::locale &s_locale );
|
||||||
|
|
||||||
/** @brief Callback used for variable creation factory functions. */
|
/** @brief Callback used for variable creation factory functions. */
|
||||||
typedef qreal* ( *facfun_type ) ( const QString &, void* );
|
typedef qreal* ( *facfun_type ) ( const QString &, void* );
|
||||||
|
|
|
@ -62,8 +62,9 @@ QmuParserTester::QmuParserTester()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::IsHexVal ( const QString &a_szExpr, int *a_iPos, qreal *a_fVal )
|
int QmuParserTester::IsHexVal ( const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const std::locale &s_locale )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(s_locale)
|
||||||
if ( a_szExpr.data()[1] == 0 || ( a_szExpr.data()[0] != '0' || a_szExpr.data()[1] != 'x' ) )
|
if ( a_szExpr.data()[1] == 0 || ( a_szExpr.data()[0] != '0' || a_szExpr.data()[1] != 'x' ) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -276,7 +276,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom value recognition
|
// Custom value recognition
|
||||||
static int IsHexVal ( const QString &a_szExpr, int *a_iPos, qreal *a_fVal );
|
static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal , const std::locale &s_locale);
|
||||||
|
|
||||||
// cppcheck-suppress functionStatic
|
// cppcheck-suppress functionStatic
|
||||||
int TestNames();
|
int TestNames();
|
||||||
|
|
|
@ -204,7 +204,7 @@ void QmuParserTokenReader::ReInit()
|
||||||
/**
|
/**
|
||||||
* @brief Read the next token from the string.
|
* @brief Read the next token from the string.
|
||||||
*/
|
*/
|
||||||
QmuParserTokenReader::token_type QmuParserTokenReader::ReadNextToken()
|
QmuParserTokenReader::token_type QmuParserTokenReader::ReadNextToken(const std::locale &s_locale)
|
||||||
{
|
{
|
||||||
assert ( m_pParser );
|
assert ( m_pParser );
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ QmuParserTokenReader::token_type QmuParserTokenReader::ReadNextToken()
|
||||||
{
|
{
|
||||||
return SaveBeforeReturn ( tok ); // Check for function argument separators
|
return SaveBeforeReturn ( tok ); // Check for function argument separators
|
||||||
}
|
}
|
||||||
if ( IsValTok ( tok ) )
|
if ( IsValTok ( tok, s_locale ) )
|
||||||
{
|
{
|
||||||
return SaveBeforeReturn ( tok ); // Check for values / constant tokens
|
return SaveBeforeReturn ( tok ); // Check for values / constant tokens
|
||||||
}
|
}
|
||||||
|
@ -766,7 +766,7 @@ bool QmuParserTokenReader::IsPostOpTok ( token_type &a_Tok )
|
||||||
* @param a_Tok [out] If a value token is found it will be placed here.
|
* @param a_Tok [out] If a value token is found it will be placed here.
|
||||||
* @return true if a value token has been found.
|
* @return true if a value token has been found.
|
||||||
*/
|
*/
|
||||||
bool QmuParserTokenReader::IsValTok ( token_type &a_Tok )
|
bool QmuParserTokenReader::IsValTok ( token_type &a_Tok, const std::locale &s_locale )
|
||||||
{
|
{
|
||||||
assert ( m_pConstDef );
|
assert ( m_pConstDef );
|
||||||
assert ( m_pParser );
|
assert ( m_pParser );
|
||||||
|
@ -802,7 +802,7 @@ bool QmuParserTokenReader::IsValTok ( token_type &a_Tok )
|
||||||
for ( item = m_vIdentFun.begin(); item != m_vIdentFun.end(); ++item )
|
for ( item = m_vIdentFun.begin(); item != m_vIdentFun.end(); ++item )
|
||||||
{
|
{
|
||||||
int iStart = m_iPos;
|
int iStart = m_iPos;
|
||||||
if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal ) == 1 )
|
if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal, s_locale ) == 1 )
|
||||||
{
|
{
|
||||||
// 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2
|
// 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2
|
||||||
strTok = m_strFormula.mid ( iStart, m_iPos-iStart );
|
strTok = m_strFormula.mid ( iStart, m_iPos-iStart );
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
QChar GetArgSep() const;
|
QChar GetArgSep() const;
|
||||||
void IgnoreUndefVar(bool bIgnore);
|
void IgnoreUndefVar(bool bIgnore);
|
||||||
void ReInit();
|
void ReInit();
|
||||||
token_type ReadNextToken();
|
token_type ReadNextToken(const std::locale &s_locale);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,7 +103,7 @@ private:
|
||||||
bool IsFunTok(token_type &a_Tok);
|
bool IsFunTok(token_type &a_Tok);
|
||||||
bool IsPostOpTok(token_type &a_Tok);
|
bool IsPostOpTok(token_type &a_Tok);
|
||||||
bool IsOprt(token_type &a_Tok);
|
bool IsOprt(token_type &a_Tok);
|
||||||
bool IsValTok(token_type &a_Tok);
|
bool IsValTok(token_type &a_Tok, const std::locale &s_locale);
|
||||||
bool IsVarTok(token_type &a_Tok);
|
bool IsVarTok(token_type &a_Tok);
|
||||||
bool IsStrVarTok(token_type &a_Tok);
|
bool IsStrVarTok(token_type &a_Tok);
|
||||||
bool IsUndefVarTok(token_type &a_Tok);
|
bool IsUndefVarTok(token_type &a_Tok);
|
||||||
|
|
|
@ -58,6 +58,7 @@ QWidget* VColorProperty::createEditor(QWidget* parent, const QStyleOptionViewIte
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
|
|
||||||
VColorPropertyEditor* tmpWidget = new VColorPropertyEditor(parent);
|
VColorPropertyEditor* tmpWidget = new VColorPropertyEditor(parent);
|
||||||
|
tmpWidget->setLocale(parent->locale());
|
||||||
tmpWidget->SetColor(d_ptr->VariantValue.value<QColor>());
|
tmpWidget->SetColor(d_ptr->VariantValue.value<QColor>());
|
||||||
return tmpWidget;
|
return tmpWidget;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ QWidget* VEnumProperty::createEditor(QWidget * parent, const QStyleOptionViewIte
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
QComboBox* tmpEditor = new QComboBox(parent);
|
QComboBox* tmpEditor = new QComboBox(parent);
|
||||||
tmpEditor->clear();
|
tmpEditor->clear();
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->addItems(EnumerationLiterals);
|
tmpEditor->addItems(EnumerationLiterals);
|
||||||
tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt());
|
tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt());
|
||||||
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
|
|
@ -87,6 +87,7 @@ QWidget* VFileProperty::createEditor(QWidget * parent, const QStyleOptionViewIte
|
||||||
VFileEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
|
VFileEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
tmpWidget->setLocale(parent->locale());
|
||||||
tmpWidget->setFilter(static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters); // todo: parse this string
|
tmpWidget->setFilter(static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters); // todo: parse this string
|
||||||
tmpWidget->setFile(d_ptr->VariantValue.toString());
|
tmpWidget->setFile(d_ptr->VariantValue.toString());
|
||||||
tmpWidget->setDirectory(static_cast<VFilePropertyPrivate*>(d_ptr)->Directory);
|
tmpWidget->setDirectory(static_cast<VFilePropertyPrivate*>(d_ptr)->Directory);
|
||||||
|
|
|
@ -86,6 +86,7 @@ QWidget *VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionVie
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt());
|
tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt());
|
||||||
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&VLineColorProperty::currentIndexChanged);
|
&VLineColorProperty::currentIndexChanged);
|
||||||
|
|
|
@ -76,6 +76,7 @@ QWidget *VLineTypeProperty::createEditor(QWidget *parent, const QStyleOptionView
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
QComboBox* tmpEditor = new QComboBox(parent);
|
QComboBox* tmpEditor = new QComboBox(parent);
|
||||||
tmpEditor->clear();
|
tmpEditor->clear();
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setIconSize(QSize(80, 14));
|
tmpEditor->setIconSize(QSize(80, 14));
|
||||||
tmpEditor->setMinimumWidth(80);
|
tmpEditor->setMinimumWidth(80);
|
||||||
tmpEditor->setMaximumWidth(110);
|
tmpEditor->setMaximumWidth(110);
|
||||||
|
|
|
@ -56,6 +56,7 @@ QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionView
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
|
|
||||||
QSpinBox* tmpEditor = new QSpinBox(parent);
|
QSpinBox* tmpEditor = new QSpinBox(parent);
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setMinimum(static_cast<int>(minValue));
|
tmpEditor->setMinimum(static_cast<int>(minValue));
|
||||||
tmpEditor->setMaximum(static_cast<int>(maxValue));
|
tmpEditor->setMaximum(static_cast<int>(maxValue));
|
||||||
tmpEditor->setSingleStep(static_cast<int>(singleStep));
|
tmpEditor->setSingleStep(static_cast<int>(singleStep));
|
||||||
|
@ -162,6 +163,7 @@ QWidget* VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewI
|
||||||
Q_UNUSED(options);
|
Q_UNUSED(options);
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
QDoubleSpinBox* tmpEditor = new QDoubleSpinBox(parent);
|
QDoubleSpinBox* tmpEditor = new QDoubleSpinBox(parent);
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setMinimum(minValue);
|
tmpEditor->setMinimum(minValue);
|
||||||
tmpEditor->setMaximum(maxValue);
|
tmpEditor->setMaximum(maxValue);
|
||||||
tmpEditor->setDecimals(Precision);
|
tmpEditor->setDecimals(Precision);
|
||||||
|
|
|
@ -64,6 +64,7 @@ QWidget* VObjectProperty::createEditor(QWidget * parent, const QStyleOptionViewI
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
QComboBox* tmpEditor = new QComboBox(parent);
|
QComboBox* tmpEditor = new QComboBox(parent);
|
||||||
tmpEditor->clear();
|
tmpEditor->clear();
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
FillList(tmpEditor, objects);
|
FillList(tmpEditor, objects);
|
||||||
tmpEditor->setCurrentIndex(tmpEditor->findData(VProperty::d_ptr->VariantValue.toUInt()));
|
tmpEditor->setCurrentIndex(tmpEditor->findData(VProperty::d_ptr->VariantValue.toUInt()));
|
||||||
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
|
|
@ -61,7 +61,7 @@ QWidget* VShortcutProperty::createEditor(QWidget * parent, const QStyleOptionVie
|
||||||
{
|
{
|
||||||
VShortcutEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
|
VShortcutEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
|
||||||
}
|
}
|
||||||
|
tmpWidget->setLocale(parent->locale());
|
||||||
return tmpWidget;
|
return tmpWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionV
|
||||||
Q_UNUSED(delegate);
|
Q_UNUSED(delegate);
|
||||||
|
|
||||||
QLineEdit* tmpEditor = new QLineEdit(parent);
|
QLineEdit* tmpEditor = new QLineEdit(parent);
|
||||||
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setReadOnly(readOnly);
|
tmpEditor->setReadOnly(readOnly);
|
||||||
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
tmpEditor->setText(d_ptr->VariantValue.toString());
|
tmpEditor->setText(d_ptr->VariantValue.toString());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user