Static Code Analysis.
--HG-- branch : develop
This commit is contained in:
parent
ff31ac889c
commit
88324a11f2
|
@ -76,16 +76,17 @@ TapeConfigurationPage::TapeConfigurationPage(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapeConfigurationPage::Apply()
|
void TapeConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->TapeSettings()->SetOsSeparator(osOptionCheck->isChecked());
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
settings->SetOsSeparator(osOptionCheck->isChecked());
|
||||||
|
|
||||||
if (langChanged || systemChanged)
|
if (langChanged || systemChanged)
|
||||||
{
|
{
|
||||||
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
||||||
qApp->TapeSettings()->SetLocale(locale);
|
settings->SetLocale(locale);
|
||||||
langChanged = false;
|
langChanged = false;
|
||||||
|
|
||||||
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
|
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
|
||||||
qApp->TapeSettings()->SetPMSystemCode(code);
|
settings->SetPMSystemCode(code);
|
||||||
systemChanged = false;
|
systemChanged = false;
|
||||||
|
|
||||||
qApp->LoadTranslation(locale);
|
qApp->LoadTranslation(locale);
|
||||||
|
@ -173,7 +174,8 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default translators and language checked
|
// set default translators and language checked
|
||||||
qint32 index = langCombo->findData(qApp->TapeSettings()->GetLocale());
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
qint32 index = langCombo->findData(settings->GetLocale());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
langCombo->setCurrentIndex(index);
|
langCombo->setCurrentIndex(index);
|
||||||
|
@ -209,7 +211,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
||||||
&TapeConfigurationPage::SystemChanged);
|
&TapeConfigurationPage::SystemChanged);
|
||||||
|
|
||||||
// set default pattern making system
|
// set default pattern making system
|
||||||
index = systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode());
|
index = systemCombo->findData(settings->GetPMSystemCode());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
systemCombo->setCurrentIndex(index);
|
systemCombo->setCurrentIndex(index);
|
||||||
|
@ -219,7 +221,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
||||||
separatorLabel = new QLabel(tr("Decimal separator parts"));
|
separatorLabel = new QLabel(tr("Decimal separator parts"));
|
||||||
|
|
||||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||||
osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
|
osOptionCheck->setChecked(settings->GetOsSeparator());
|
||||||
|
|
||||||
langLayout->addRow(separatorLabel, osOptionCheck);
|
langLayout->addRow(separatorLabel, osOptionCheck);
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
|
|
@ -65,9 +65,10 @@ TapePathPage::TapePathPage(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapePathPage::Apply()
|
void TapePathPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->TapeSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
qApp->TapeSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
settings->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
||||||
qApp->TapeSettings()->SetPathTemplate(pathTable->item(2, 1)->text());
|
settings->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
||||||
|
settings->SetPathTemplate(pathTable->item(2, 1)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -194,24 +195,26 @@ void TapePathPage::InitTable()
|
||||||
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
||||||
pathTable->setHorizontalHeaderLabels(tableHeader);
|
pathTable->setHorizontalHeaderLabels(tableHeader);
|
||||||
|
|
||||||
|
const VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathIndividualMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||||
item->setToolTip(qApp->TapeSettings()->GetPathIndividualMeasurements());
|
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||||
pathTable->setItem(0, 1, item);
|
pathTable->setItem(0, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathStandardMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
||||||
item->setToolTip(qApp->TapeSettings()->GetPathStandardMeasurements());
|
item->setToolTip(settings->GetPathStandardMeasurements());
|
||||||
pathTable->setItem(1, 1, item);
|
pathTable->setItem(1, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Templates")));
|
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Templates")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathTemplate());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
||||||
item->setToolTip(qApp->TapeSettings()->GetPathTemplate());
|
item->setToolTip(settings->GetPathTemplate());
|
||||||
pathTable->setItem(2, 1, item);
|
pathTable->setItem(2, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,31 +236,29 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column)
|
||||||
}
|
}
|
||||||
else if (item->childCount() == 0 || column == -1)
|
else if (item->childCount() == 0 || column == -1)
|
||||||
{
|
{
|
||||||
if (item->parent() == nullptr)
|
QTreeWidgetItem *parent = item->parent();
|
||||||
|
if (parent == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < item->parent()->childCount(); ++j)
|
for (int j = 0; j < parent->childCount(); ++j)
|
||||||
{
|
{
|
||||||
if (j != item->parent()->indexOfChild(item)
|
if (j != parent->indexOfChild(item)
|
||||||
&& item->checkState(0) != item->parent()->child(j)->checkState(0))
|
&& item->checkState(0) != parent->child(j)->checkState(0))
|
||||||
{
|
{
|
||||||
diff = true;
|
diff = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (diff)
|
if (diff)
|
||||||
{
|
{
|
||||||
item->parent()->setCheckState(0, Qt::PartiallyChecked);
|
parent->setCheckState(0, Qt::PartiallyChecked);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->parent()->setCheckState(0, item->checkState(0));
|
parent->setCheckState(0, item->checkState(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->parent() != nullptr)
|
UpdateChecks(parent, -1);
|
||||||
{
|
|
||||||
UpdateChecks(item->parent(), -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +284,8 @@ void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString name = item->data(0, Qt::UserRole).toString();
|
const QString name = item->data(0, Qt::UserRole).toString();
|
||||||
const QString number = qApp->TrVars()->MNumber(name);
|
const VTranslateVars *trv = qApp->TrVars();
|
||||||
|
const QString number = trv->MNumber(name);
|
||||||
const QString iconPath = QString("://diagrams/%1.png").arg(MapDiagrams(number));
|
const QString iconPath = QString("://diagrams/%1.png").arg(MapDiagrams(number));
|
||||||
|
|
||||||
QString text = QString("<p align=\"center\" style=\"font-variant: normal; font-style: normal; font-weight: "
|
QString text = QString("<p align=\"center\" style=\"font-variant: normal; font-style: normal; font-weight: "
|
||||||
|
@ -296,8 +295,8 @@ void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
|
||||||
"%5</p>")
|
"%5</p>")
|
||||||
.arg(iconPath)
|
.arg(iconPath)
|
||||||
.arg(number)
|
.arg(number)
|
||||||
.arg(qApp->TrVars()->GuiText(name))
|
.arg(trv->GuiText(name))
|
||||||
.arg(qApp->TrVars()->Description(name));
|
.arg(trv->Description(name));
|
||||||
|
|
||||||
ui->textEdit->setHtml(text);
|
ui->textEdit->setHtml(text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE(); //-V501
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ bool MApplication::notify(QObject *receiver, QEvent *event)
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")),
|
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
exit(V_EX_DATAERR);
|
exit(V_EX_DATAERR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,17 +108,9 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TMainWindow::~TMainWindow()
|
TMainWindow::~TMainWindow()
|
||||||
{
|
|
||||||
if (data != nullptr)
|
|
||||||
{
|
{
|
||||||
delete data;
|
delete data;
|
||||||
}
|
|
||||||
|
|
||||||
if (m != nullptr)
|
|
||||||
{
|
|
||||||
delete m;
|
delete m;
|
||||||
}
|
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2411,20 +2403,22 @@ void TMainWindow::MeasurementReadOnly(bool ro)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::ReadSettings()
|
void TMainWindow::ReadSettings()
|
||||||
{
|
{
|
||||||
restoreGeometry(qApp->TapeSettings()->GetGeometry());
|
const VTapeSettings *settings = qApp->TapeSettings();
|
||||||
restoreState(qApp->TapeSettings()->GetWindowState());
|
restoreGeometry(settings->GetGeometry());
|
||||||
restoreState(qApp->TapeSettings()->GetToolbarsState(), APP_VERSION);
|
restoreState(settings->GetWindowState());
|
||||||
|
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||||
|
|
||||||
// Stack limit
|
// Stack limit
|
||||||
//qApp->getUndoStack()->setUndoLimit(qApp->TapeSettings()->GetUndoCount());
|
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::WriteSettings()
|
void TMainWindow::WriteSettings()
|
||||||
{
|
{
|
||||||
qApp->TapeSettings()->SetGeometry(saveGeometry());
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
qApp->TapeSettings()->SetWindowState(saveState());
|
settings->SetGeometry(saveGeometry());
|
||||||
qApp->TapeSettings()->SetToolbarsState(saveState(APP_VERSION));
|
settings->SetWindowState(saveState());
|
||||||
|
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -307,7 +307,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
qCCritical(vApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")),
|
qCCritical(vApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
exit(V_EX_DATAERR);
|
exit(V_EX_DATAERR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -591,7 +591,7 @@ void VToolOptionsPropertyBrowser::SetPointName2(const QString &name)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant value)
|
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value)
|
||||||
{
|
{
|
||||||
if (Tool *i = qgraphicsitem_cast<Tool *>(currentItem))
|
if (Tool *i = qgraphicsitem_cast<Tool *>(currentItem))
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ private:
|
||||||
void SetPointName2(const QString &name);
|
void SetPointName2(const QString &name);
|
||||||
|
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void SetCrossCirclesPoint(const QVariant value);
|
void SetCrossCirclesPoint(const QVariant &value);
|
||||||
|
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void AddPropertyPointName(Tool *i, const QString &propertyName);
|
void AddPropertyPointName(Tool *i, const QString &propertyName);
|
||||||
|
|
|
@ -57,17 +57,18 @@ CommunityPage::CommunityPage(QWidget *parent):
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void CommunityPage::Apply()
|
void CommunityPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->ValentinaSettings()->SetServer(this->server->text());
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
qApp->ValentinaSettings()->SetServerSecure(this->secureComm->isChecked());
|
settings->SetServer(this->server->text());
|
||||||
qApp->ValentinaSettings()->SetProxy(this->useProxy->isChecked());
|
settings->SetServerSecure(this->secureComm->isChecked());
|
||||||
qApp->ValentinaSettings()->SetProxyAddress(this->proxyAddress->text());
|
settings->SetProxy(this->useProxy->isChecked());
|
||||||
qApp->ValentinaSettings()->SetProxyPort(this->proxyPort->text());
|
settings->SetProxyAddress(this->proxyAddress->text());
|
||||||
qApp->ValentinaSettings()->SetProxyUser(this->proxyUser->text());
|
settings->SetProxyPort(this->proxyPort->text());
|
||||||
qApp->ValentinaSettings()->SetProxyPass(this->proxyPass->text());
|
settings->SetProxyUser(this->proxyUser->text());
|
||||||
|
settings->SetProxyPass(this->proxyPass->text());
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetUsername(this->username->text());
|
settings->SetUsername(this->username->text());
|
||||||
qApp->ValentinaSettings()->SetSavePassword(this->savePassword->isChecked());
|
settings->SetSavePassword(this->savePassword->isChecked());
|
||||||
qApp->ValentinaSettings()->SetUserPassword(this->userpassword->text());
|
settings->SetUserPassword(this->userpassword->text());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,12 +137,13 @@ QGroupBox *CommunityPage::ProxyGroup()
|
||||||
|
|
||||||
QFormLayout *proxyLayout = new QFormLayout;
|
QFormLayout *proxyLayout = new QFormLayout;
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->ValentinaSettings()->GetProxy(), tr("Use Proxy"));
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->ValentinaSettings()->GetProxyAddress(),
|
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy"));
|
||||||
|
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
|
||||||
tr("Proxy address"));
|
tr("Proxy address"));
|
||||||
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->ValentinaSettings()->GetProxyPort(), tr("Proxy port"));
|
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port"));
|
||||||
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->ValentinaSettings()->GetProxyUser(), tr("Proxy user"));
|
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user"));
|
||||||
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->ValentinaSettings()->GetProxyPass(), tr("Proxy pass"));
|
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass"));
|
||||||
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
||||||
this->ProxyCheckChanged();
|
this->ProxyCheckChanged();
|
||||||
|
|
||||||
|
@ -156,11 +158,10 @@ QGroupBox *CommunityPage::UserGroup()
|
||||||
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
||||||
QFormLayout *userLayout = new QFormLayout;
|
QFormLayout *userLayout = new QFormLayout;
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->username, userLayout, qApp->ValentinaSettings()->GetUsername(), tr("User Name"));
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->ValentinaSettings()->GetSavePassword(),
|
CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name"));
|
||||||
tr("Save password"));
|
CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password"));
|
||||||
CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->ValentinaSettings()->GetUserPassword(),
|
CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password"));
|
||||||
tr("Password"));
|
|
||||||
|
|
||||||
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
||||||
this->PasswordCheckChanged();
|
this->PasswordCheckChanged();
|
||||||
|
|
|
@ -67,23 +67,24 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void ConfigurationPage::Apply()
|
void ConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->ValentinaSettings()->SetAutosaveState(autoSaveCheck->isChecked());
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
qApp->ValentinaSettings()->SetAutosaveTime(autoTime->value());
|
settings->SetAutosaveState(autoSaveCheck->isChecked());
|
||||||
|
settings->SetAutosaveTime(autoTime->value());
|
||||||
|
|
||||||
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
||||||
SCASSERT(autoSaveTimer);
|
SCASSERT(autoSaveTimer);
|
||||||
|
|
||||||
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();
|
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetOsSeparator(osOptionCheck->isChecked());
|
settings->SetOsSeparator(osOptionCheck->isChecked());
|
||||||
qApp->ValentinaSettings()->SetSendReportState(sendReportCheck->isChecked());
|
settings->SetSendReportState(sendReportCheck->isChecked());
|
||||||
qApp->ValentinaSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
|
settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
|
||||||
qApp->ValentinaSettings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
|
settings->SetToolBarStyle(toolBarStyleCheck->isChecked());
|
||||||
|
|
||||||
if (langChanged)
|
if (langChanged)
|
||||||
{
|
{
|
||||||
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
||||||
qApp->ValentinaSettings()->SetLocale(locale);
|
settings->SetLocale(locale);
|
||||||
langChanged = false;
|
langChanged = false;
|
||||||
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
|
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
|
||||||
QApplication::applicationName();
|
QApplication::applicationName();
|
||||||
|
@ -92,7 +93,7 @@ void ConfigurationPage::Apply()
|
||||||
if (this->unitChanged)
|
if (this->unitChanged)
|
||||||
{
|
{
|
||||||
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
||||||
qApp->ValentinaSettings()->SetUnit(unit);
|
settings->SetUnit(unit);
|
||||||
this->unitChanged = false;
|
this->unitChanged = false;
|
||||||
const QString text = tr("Default unit updated and will be used the next pattern creation");
|
const QString text = tr("Default unit updated and will be used the next pattern creation");
|
||||||
QMessageBox::information(this, QApplication::applicationName(), text);
|
QMessageBox::information(this, QApplication::applicationName(), text);
|
||||||
|
@ -100,7 +101,7 @@ void ConfigurationPage::Apply()
|
||||||
if (labelLangChanged)
|
if (labelLangChanged)
|
||||||
{
|
{
|
||||||
const QString locale = qvariant_cast<QString>(labelCombo->itemData(labelCombo->currentIndex()));
|
const QString locale = qvariant_cast<QString>(labelCombo->itemData(labelCombo->currentIndex()));
|
||||||
qApp->ValentinaSettings()->SetLabelLanguage(locale);
|
settings->SetLabelLanguage(locale);
|
||||||
labelLangChanged = false;
|
labelLangChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +182,8 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default translators and language checked
|
// set default translators and language checked
|
||||||
qint32 index = langCombo->findData(qApp->ValentinaSettings()->GetLocale());
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
qint32 index = langCombo->findData(settings->GetLocale());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
langCombo->setCurrentIndex(index);
|
langCombo->setCurrentIndex(index);
|
||||||
|
@ -197,7 +199,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
||||||
|
|
||||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||||
osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator());
|
osOptionCheck->setChecked(settings->GetOsSeparator());
|
||||||
|
|
||||||
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
||||||
separatorLayout->addWidget(separatorLabel);
|
separatorLayout->addWidget(separatorLabel);
|
||||||
|
@ -212,7 +214,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
this->unitCombo->addItem(tr("Inches"), "in");
|
this->unitCombo->addItem(tr("Inches"), "in");
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
qint32 indexUnit = this->unitCombo->findData(qApp->ValentinaSettings()->GetUnit());
|
qint32 indexUnit = this->unitCombo->findData(settings->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
this->unitCombo->setCurrentIndex(indexUnit);
|
this->unitCombo->setCurrentIndex(indexUnit);
|
||||||
|
@ -231,7 +233,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
|
|
||||||
SetLabelComboBox(VApplication::LabelLanguages());
|
SetLabelComboBox(VApplication::LabelLanguages());
|
||||||
|
|
||||||
index = labelCombo->findData(qApp->ValentinaSettings()->GetLabelLanguage());
|
index = labelCombo->findData(settings->GetLabelLanguage());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
labelCombo->setCurrentIndex(index);
|
labelCombo->setCurrentIndex(index);
|
||||||
|
|
|
@ -62,11 +62,12 @@ PathPage::PathPage(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PathPage::Apply()
|
void PathPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->ValentinaSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
qApp->ValentinaSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
settings->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
||||||
qApp->ValentinaSettings()->SetPathPattern(pathTable->item(2, 1)->text());
|
settings->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
||||||
qApp->ValentinaSettings()->SetPathLayout(pathTable->item(3, 1)->text());
|
settings->SetPathPattern(pathTable->item(2, 1)->text());
|
||||||
qApp->ValentinaSettings()->SetPathTemplate(pathTable->item(4, 1)->text());
|
settings->SetPathLayout(pathTable->item(3, 1)->text());
|
||||||
|
settings->SetPathTemplate(pathTable->item(4, 1)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -187,39 +188,40 @@ void PathPage::InitTable()
|
||||||
|
|
||||||
QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
||||||
pathTable->setHorizontalHeaderLabels(tableHeader);
|
pathTable->setHorizontalHeaderLabels(tableHeader);
|
||||||
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathIndividualMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||||
item->setToolTip(qApp->ValentinaSettings()->GetPathIndividualMeasurements());
|
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||||
pathTable->setItem(0, 1, item);
|
pathTable->setItem(0, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathStandardMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
||||||
item->setToolTip(qApp->ValentinaSettings()->GetPathStandardMeasurements());
|
item->setToolTip(settings->GetPathStandardMeasurements());
|
||||||
pathTable->setItem(1, 1, item);
|
pathTable->setItem(1, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
|
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathPattern());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathPattern());
|
||||||
item->setToolTip(qApp->ValentinaSettings()->GetPathPattern());
|
item->setToolTip(settings->GetPathPattern());
|
||||||
pathTable->setItem(2, 1, item);
|
pathTable->setItem(2, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
|
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathLayout());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathLayout());
|
||||||
item->setToolTip(qApp->ValentinaSettings()->GetPathLayout());
|
item->setToolTip(settings->GetPathLayout());
|
||||||
pathTable->setItem(3, 1, item);
|
pathTable->setItem(3, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(4, 0, new QTableWidgetItem(tr("Templates")));
|
pathTable->setItem(4, 0, new QTableWidgetItem(tr("Templates")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathTemplate());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
||||||
item->setToolTip(qApp->ValentinaSettings()->GetPathTemplate());
|
item->setToolTip(settings->GetPathTemplate());
|
||||||
pathTable->setItem(4, 1, item);
|
pathTable->setItem(4, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,17 +58,18 @@ PatternPage::PatternPage(QWidget *parent):
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PatternPage::Apply()
|
void PatternPage::Apply()
|
||||||
{
|
{
|
||||||
qApp->ValentinaSettings()->SetUser(userName->text());
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
settings->SetUser(userName->text());
|
||||||
|
|
||||||
// Scene antialiasing
|
// Scene antialiasing
|
||||||
qApp->ValentinaSettings()->SetGraphicalOutput(graphOutputCheck->isChecked());
|
settings->SetGraphicalOutput(graphOutputCheck->isChecked());
|
||||||
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
||||||
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
||||||
|
|
||||||
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
||||||
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
||||||
* prints a warning and does nothing.*/
|
* prints a warning and does nothing.*/
|
||||||
qApp->ValentinaSettings()->SetUndoCount(undoCount->value());
|
settings->SetUndoCount(undoCount->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -211,7 +211,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
switch ( tool.getTypeTool() )
|
switch ( tool.getTypeTool() )
|
||||||
{
|
{
|
||||||
case Tool::Arrow:
|
case Tool::Arrow:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE(); //-V501
|
||||||
break;
|
break;
|
||||||
case Tool::BasePoint:
|
case Tool::BasePoint:
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,7 +158,7 @@ void DialogIncrements::FillIncrements()
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DialogIncrements::FillTable(const QMap<QString, T> varTable, QTableWidget *table)
|
void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget *table)
|
||||||
{
|
{
|
||||||
SCASSERT(table != nullptr);
|
SCASSERT(table != nullptr);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
Ui::DialogIncrements *ui;
|
Ui::DialogIncrements *ui;
|
||||||
|
|
||||||
/** @brief data container with data */
|
/** @brief data container with data */
|
||||||
VContainer *data; // need because we must change data
|
VContainer *data; // need because we must change data //-V703
|
||||||
|
|
||||||
/** @brief doc dom document container */
|
/** @brief doc dom document container */
|
||||||
VPattern *doc;
|
VPattern *doc;
|
||||||
|
@ -88,7 +88,7 @@ private:
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void FillTable(const QMap<QString, T> varTable, QTableWidget *table);
|
void FillTable(const QMap<QString, T> &varTable, QTableWidget *table);
|
||||||
|
|
||||||
void FillIncrements();
|
void FillIncrements();
|
||||||
void FillLengthsLines();
|
void FillLengthsLines();
|
||||||
|
|
|
@ -694,34 +694,35 @@ void DialogLayoutSettings::MinimumLayoutSize()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::ReadSettings()
|
void DialogLayoutSettings::ReadSettings()
|
||||||
{
|
{
|
||||||
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
SetLayoutWidth(settings->GetLayoutWidth());
|
||||||
|
SetShift(settings->GetLayoutShift());
|
||||||
|
|
||||||
SetLayoutWidth(qApp->ValentinaSettings()->GetLayoutWidth());
|
const qreal width = UnitConvertor(settings->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
||||||
SetShift(qApp->ValentinaSettings()->GetLayoutShift());
|
const qreal height = UnitConvertor(settings->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
||||||
|
|
||||||
const qreal width = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
|
||||||
const qreal height = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
|
||||||
SheetSize(QSizeF(width, height));
|
SheetSize(QSizeF(width, height));
|
||||||
SetGroup(qApp->ValentinaSettings()->GetLayoutGroup());
|
SetGroup(settings->GetLayoutGroup());
|
||||||
SetRotate(qApp->ValentinaSettings()->GetLayoutRotate());
|
SetRotate(settings->GetLayoutRotate());
|
||||||
SetIncrease(qApp->ValentinaSettings()->GetLayoutRotationIncrease());
|
SetIncrease(settings->GetLayoutRotationIncrease());
|
||||||
SetAutoCrop(qApp->ValentinaSettings()->GetLayoutAutoCrop());
|
SetAutoCrop(settings->GetLayoutAutoCrop());
|
||||||
SetSaveLength(qApp->ValentinaSettings()->GetLayoutSaveLength());
|
SetSaveLength(settings->GetLayoutSaveLength());
|
||||||
SetUnitePages(qApp->ValentinaSettings()->GetLayoutUnitePages());
|
SetUnitePages(settings->GetLayoutUnitePages());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::WriteSettings() const
|
void DialogLayoutSettings::WriteSettings() const
|
||||||
{
|
{
|
||||||
qApp->ValentinaSettings()->SetLayoutWidth(GetLayoutWidth());
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
qApp->ValentinaSettings()->SetLayoutGroup(GetGroup());
|
settings->SetLayoutWidth(GetLayoutWidth());
|
||||||
qApp->ValentinaSettings()->SetLayoutPaperHeight(GetPaperHeight());
|
settings->SetLayoutGroup(GetGroup());
|
||||||
qApp->ValentinaSettings()->SetLayoutPaperWidth(GetPaperWidth());
|
settings->SetLayoutPaperHeight(GetPaperHeight());
|
||||||
qApp->ValentinaSettings()->SetLayoutShift(GetShift());
|
settings->SetLayoutPaperWidth(GetPaperWidth());
|
||||||
qApp->ValentinaSettings()->SetLayoutRotate(GetRotate());
|
settings->SetLayoutShift(GetShift());
|
||||||
qApp->ValentinaSettings()->SetLayoutRotationIncrease(GetIncrease());
|
settings->SetLayoutRotate(GetRotate());
|
||||||
qApp->ValentinaSettings()->SetLayoutAutoCrop(GetAutoCrop());
|
settings->SetLayoutRotationIncrease(GetIncrease());
|
||||||
qApp->ValentinaSettings()->SetLayoutSaveLength(IsSaveLength());
|
settings->SetLayoutAutoCrop(GetAutoCrop());
|
||||||
qApp->ValentinaSettings()->SetLayoutUnitePages(IsUnitePages());
|
settings->SetLayoutSaveLength(IsSaveLength());
|
||||||
|
settings->SetLayoutUnitePages(IsUnitePages());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -589,23 +589,11 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
|
||||||
ChangesStackElement* index = this->changeStackRoot;
|
ChangesStackElement* index = this->changeStackRoot;
|
||||||
|
|
||||||
if (changeStackRoot == elmt)
|
if (changeStackRoot == elmt)
|
||||||
{
|
|
||||||
if (elmt->newText != nullptr)
|
|
||||||
{
|
{
|
||||||
delete elmt->newText;
|
delete elmt->newText;
|
||||||
}
|
|
||||||
if (elmt->newValue != nullptr)
|
|
||||||
{
|
|
||||||
delete elmt->newValue;
|
delete elmt->newValue;
|
||||||
}
|
|
||||||
if (elmt->oldText != nullptr)
|
|
||||||
{
|
|
||||||
delete elmt->oldText;
|
delete elmt->oldText;
|
||||||
}
|
|
||||||
if (elmt->oldValue != nullptr)
|
|
||||||
{
|
|
||||||
delete elmt->oldValue;
|
delete elmt->oldValue;
|
||||||
}
|
|
||||||
this->changeStackRoot = elmt->next;
|
this->changeStackRoot = elmt->next;
|
||||||
if (this->changeStackLast == elmt)
|
if (this->changeStackLast == elmt)
|
||||||
{
|
{
|
||||||
|
@ -627,22 +615,10 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
|
||||||
SCASSERT(index->next != nullptr);
|
SCASSERT(index->next != nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (index->next->newText != nullptr)
|
|
||||||
{
|
|
||||||
delete index->next->newText;
|
delete index->next->newText;
|
||||||
}
|
|
||||||
if (index->next->newValue != nullptr)
|
|
||||||
{
|
|
||||||
delete index->next->newValue;
|
delete index->next->newValue;
|
||||||
}
|
|
||||||
if (index->next->oldText != nullptr)
|
|
||||||
{
|
|
||||||
delete index->next->oldText;
|
delete index->next->oldText;
|
||||||
}
|
|
||||||
if (index->next->oldValue != nullptr)
|
|
||||||
{
|
|
||||||
delete index->next->oldValue;
|
delete index->next->oldValue;
|
||||||
}
|
|
||||||
index->next=index->next->next;
|
index->next=index->next->next;
|
||||||
if (this->changeStackLast == elmt)
|
if (this->changeStackLast == elmt)
|
||||||
{
|
{
|
||||||
|
@ -903,7 +879,7 @@ void DialogPatternXmlEdit::NameTextEdited(QString newtext)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternXmlEdit::ValueTextEdited(QString newtext)
|
void DialogPatternXmlEdit::ValueTextEdited(QString newtext) //-V524
|
||||||
{
|
{
|
||||||
Q_UNUSED(newtext)
|
Q_UNUSED(newtext)
|
||||||
//QMessageBox::information(this, "valueTextEdited", QString("%1").arg(newtext));
|
//QMessageBox::information(this, "valueTextEdited", QString("%1").arg(newtext));
|
||||||
|
@ -933,15 +909,9 @@ void DialogPatternXmlEdit::ClearStack()
|
||||||
{
|
{
|
||||||
ChangesStackElement * tmp;
|
ChangesStackElement * tmp;
|
||||||
while (changeStackRoot != nullptr)
|
while (changeStackRoot != nullptr)
|
||||||
{
|
|
||||||
if (changeStackRoot->newText != nullptr)
|
|
||||||
{
|
{
|
||||||
delete changeStackRoot->newText;
|
delete changeStackRoot->newText;
|
||||||
}
|
|
||||||
if (changeStackRoot->newValue != nullptr)
|
|
||||||
{
|
|
||||||
delete changeStackRoot->newValue;
|
delete changeStackRoot->newValue;
|
||||||
}
|
|
||||||
tmp=changeStackRoot;
|
tmp=changeStackRoot;
|
||||||
changeStackRoot=changeStackRoot->next;
|
changeStackRoot=changeStackRoot->next;
|
||||||
delete tmp;
|
delete tmp;
|
||||||
|
@ -1084,13 +1054,14 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML
|
||||||
{
|
{
|
||||||
for (int i = 0; i < tNode.attributes().size(); i++)
|
for (int i = 0; i < tNode.attributes().size(); i++)
|
||||||
{
|
{
|
||||||
if ((tNode.attributes().item(i).nodeName() == "name")
|
const QDomNode node = tNode.attributes().item(i);
|
||||||
|
if ((node.nodeName() == "name")
|
||||||
&& (refresh == false))
|
&& (refresh == false))
|
||||||
{
|
{
|
||||||
ui->comboBox_Base_Selection->addItem(tNode.attributes().item(i).nodeValue(),
|
ui->comboBox_Base_Selection->addItem(node.nodeValue(),
|
||||||
QVariant(rootBasesNum));
|
QVariant(rootBasesNum));
|
||||||
rootBases[rootBasesNum]=new VXMLTreeElement(
|
rootBases[rootBasesNum]=new VXMLTreeElement(
|
||||||
QString("Drawing %1").arg(tNode.attributes().item(i).nodeValue()),
|
QString("Drawing %1").arg(node.nodeValue()),
|
||||||
VXMLTreeElement::TypeRoot, tNode, false);
|
VXMLTreeElement::TypeRoot, tNode, false);
|
||||||
rootBasesNum++;
|
rootBasesNum++;
|
||||||
//QStandardItem* rootNode = (QStandardItem*) rootBases[rootBasesNum]->invisibleRootItem();
|
//QStandardItem* rootNode = (QStandardItem*) rootBases[rootBasesNum]->invisibleRootItem();
|
||||||
|
@ -1124,11 +1095,12 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML
|
||||||
tElement->SetTreeNodeValue(tNode.nodeValue());
|
tElement->SetTreeNodeValue(tNode.nodeValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < tNode.attributes().size(); i++)
|
const QDomNamedNodeMap attr = tNode.attributes();
|
||||||
|
for (int i = 0; i < attr.size(); i++)
|
||||||
{
|
{
|
||||||
tElement2 = new VXMLTreeElement(tNode.attributes().item(i).nodeName(), VXMLTreeElement::TypeAttr,
|
tElement2 = new VXMLTreeElement(attr.item(i).nodeName(), VXMLTreeElement::TypeAttr,
|
||||||
tNode, false);
|
tNode, false);
|
||||||
tElement2->SetTreeNodeValue(tNode.attributes().item(i).nodeValue());
|
tElement2->SetTreeNodeValue(attr.item(i).nodeValue());
|
||||||
tElement->appendRow(tElement2);
|
tElement->appendRow(tElement2);
|
||||||
xmlmodel->appendchain(tElement2);
|
xmlmodel->appendchain(tElement2);
|
||||||
}
|
}
|
||||||
|
@ -1172,22 +1144,12 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt)
|
||||||
if (last == nullptr)
|
if (last == nullptr)
|
||||||
{ // first element
|
{ // first element
|
||||||
current = new TreeElementchain;
|
current = new TreeElementchain;
|
||||||
if (current == nullptr)
|
|
||||||
{
|
|
||||||
SCASSERT(current != nullptr);
|
|
||||||
// TODO : throw exception
|
|
||||||
}
|
|
||||||
current->elmt=elmt;
|
current->elmt=elmt;
|
||||||
current->next=nullptr;
|
current->next=nullptr;
|
||||||
last=items=current;
|
last=items=current;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TreeElementchain* temp= new TreeElementchain;
|
TreeElementchain* temp= new TreeElementchain;
|
||||||
if (temp == nullptr)
|
|
||||||
{
|
|
||||||
SCASSERT(temp != nullptr);
|
|
||||||
// TODO : throw exception
|
|
||||||
}
|
|
||||||
temp->elmt=elmt;
|
temp->elmt=elmt;
|
||||||
temp->next=nullptr;
|
temp->next=nullptr;
|
||||||
last->next=temp;
|
last->next=temp;
|
||||||
|
|
|
@ -1540,7 +1540,7 @@ void MainWindow::CancelTool()
|
||||||
ui->actionStopTool->setEnabled(true);
|
ui->actionStopTool->setEnabled(true);
|
||||||
return;
|
return;
|
||||||
case Tool::BasePoint:
|
case Tool::BasePoint:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE(); //-V501
|
||||||
//Nothing to do here because we can't create this tool from main window.
|
//Nothing to do here because we can't create this tool from main window.
|
||||||
break;
|
break;
|
||||||
case Tool::EndLine:
|
case Tool::EndLine:
|
||||||
|
@ -2231,7 +2231,7 @@ void MainWindow::FullParseFile()
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
|
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
SetEnabledGUI(false);
|
SetEnabledGUI(false);
|
||||||
if (not VApplication::CheckGUI())
|
if (not VApplication::CheckGUI())
|
||||||
|
@ -2836,7 +2836,8 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Updating recent file list.");
|
qCDebug(vMainWindow, "Updating recent file list.");
|
||||||
QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
QStringList files = settings->GetRecentFileList();
|
||||||
files.removeAll(fileName);
|
files.removeAll(fileName);
|
||||||
files.prepend(fileName);
|
files.prepend(fileName);
|
||||||
while (files.size() > MaxRecentFiles)
|
while (files.size() > MaxRecentFiles)
|
||||||
|
@ -2844,14 +2845,14 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
||||||
files.removeLast();
|
files.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetRecentFileList(files);
|
settings->SetRecentFileList(files);
|
||||||
UpdateRecentFileActions();
|
UpdateRecentFileActions();
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Updating restore file list.");
|
qCDebug(vMainWindow, "Updating restore file list.");
|
||||||
QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
|
QStringList restoreFiles = settings->GetRestoreFileList();
|
||||||
restoreFiles.removeAll(fileName);
|
restoreFiles.removeAll(fileName);
|
||||||
restoreFiles.prepend(fileName);
|
restoreFiles.prepend(fileName);
|
||||||
qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
|
settings->SetRestoreFileList(restoreFiles);
|
||||||
}
|
}
|
||||||
shownName+="[*]";
|
shownName+="[*]";
|
||||||
setWindowTitle(shownName);
|
setWindowTitle(shownName);
|
||||||
|
@ -2875,17 +2876,18 @@ QString MainWindow::strippedName(const QString &fullFileName)
|
||||||
void MainWindow::ReadSettings()
|
void MainWindow::ReadSettings()
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Reading settings.");
|
qCDebug(vMainWindow, "Reading settings.");
|
||||||
restoreGeometry(qApp->ValentinaSettings()->GetGeometry());
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
restoreState(qApp->ValentinaSettings()->GetWindowState());
|
restoreGeometry(settings->GetGeometry());
|
||||||
restoreState(qApp->ValentinaSettings()->GetToolbarsState(), APP_VERSION);
|
restoreState(settings->GetWindowState());
|
||||||
|
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||||
|
|
||||||
// Scene antialiasing
|
// Scene antialiasing
|
||||||
const bool graphOutputValue = qApp->ValentinaSettings()->GetGraphicalOutput();
|
const bool graphOutputValue = settings->GetGraphicalOutput();
|
||||||
ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
||||||
ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
||||||
|
|
||||||
// Stack limit
|
// Stack limit
|
||||||
qApp->getUndoStack()->setUndoLimit(qApp->ValentinaSettings()->GetUndoCount());
|
qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
||||||
|
|
||||||
// Text under tool buton icon
|
// Text under tool buton icon
|
||||||
ToolBarStyles();
|
ToolBarStyles();
|
||||||
|
@ -2899,9 +2901,10 @@ void MainWindow::WriteSettings()
|
||||||
{
|
{
|
||||||
ActionDraw(true);
|
ActionDraw(true);
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetGeometry(saveGeometry());
|
VSettings *setings = qApp->ValentinaSettings();
|
||||||
qApp->ValentinaSettings()->SetWindowState(saveState());
|
setings->SetGeometry(saveGeometry());
|
||||||
qApp->ValentinaSettings()->SetToolbarsState(saveState(APP_VERSION));
|
setings->SetWindowState(saveState());
|
||||||
|
setings->SetToolbarsState(saveState(APP_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3004,7 +3007,7 @@ void MainWindow::LastUsedTool()
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
break;
|
break;
|
||||||
case Tool::BasePoint:
|
case Tool::BasePoint:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE(); //-V501
|
||||||
//Nothing to do here because we can't create this tool from main window.
|
//Nothing to do here because we can't create this tool from main window.
|
||||||
break;
|
break;
|
||||||
case Tool::EndLine:
|
case Tool::EndLine:
|
||||||
|
@ -3849,7 +3852,8 @@ void MainWindow::SetHeight(const QString &text)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ProcessCMD()
|
void MainWindow::ProcessCMD()
|
||||||
{
|
{
|
||||||
auto args = qApp->CommandLine()->OptInputFileNames();
|
const VCommandLinePtr cmd = qApp->CommandLine();
|
||||||
|
auto args = cmd->OptInputFileNames();
|
||||||
|
|
||||||
//Before we load pattern show window.
|
//Before we load pattern show window.
|
||||||
if (VApplication::CheckGUI())
|
if (VApplication::CheckGUI())
|
||||||
|
@ -3869,33 +3873,33 @@ void MainWindow::ProcessCMD()
|
||||||
|
|
||||||
for (int i=0, sz = args.size(); i < sz; ++i)
|
for (int i=0, sz = args.size(); i < sz; ++i)
|
||||||
{
|
{
|
||||||
const bool loaded = LoadPattern(args.at(static_cast<int>(i)), qApp->CommandLine()->OptMeasurePath());
|
const bool loaded = LoadPattern(args.at(static_cast<int>(i)), cmd->OptMeasurePath());
|
||||||
|
|
||||||
if (not loaded && not VApplication::CheckGUI())
|
if (not loaded && not VApplication::CheckGUI())
|
||||||
{
|
{
|
||||||
return; // process only one input file
|
return; // process only one input file
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qApp->CommandLine()->IsTestModeEnabled() || qApp->CommandLine()->IsExportEnabled())
|
if (cmd->IsTestModeEnabled() || cmd->IsExportEnabled())
|
||||||
{
|
{
|
||||||
if (qApp->CommandLine()->IsSetGradationSize())
|
if (cmd->IsSetGradationSize())
|
||||||
{
|
{
|
||||||
SetSize(qApp->CommandLine()->OptGradationSize());
|
SetSize(cmd->OptGradationSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qApp->CommandLine()->IsSetGradationHeight())
|
if (cmd->IsSetGradationHeight())
|
||||||
{
|
{
|
||||||
SetHeight(qApp->CommandLine()->OptGradationHeight());
|
SetHeight(cmd->OptGradationHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not qApp->CommandLine()->IsTestModeEnabled())
|
if (not cmd->IsTestModeEnabled())
|
||||||
{
|
{
|
||||||
if (qApp->CommandLine()->IsExportEnabled())
|
if (cmd->IsExportEnabled())
|
||||||
{
|
{
|
||||||
if (loaded)
|
if (loaded)
|
||||||
{
|
{
|
||||||
DoExport(qApp->CommandLine());
|
DoExport(cmd);
|
||||||
return; // process only one input file
|
return; // process only one input file
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -419,11 +419,11 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
|
||||||
{
|
{
|
||||||
idetail.next();
|
idetail.next();
|
||||||
VLayoutDetail det = VLayoutDetail();
|
VLayoutDetail det = VLayoutDetail();
|
||||||
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
const VDetail &d = idetail.value();
|
||||||
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern),
|
det.SetCountourPoints(d.ContourPoints(pattern));
|
||||||
idetail.value().getSeamAllowance());
|
det.SetSeamAllowencePoints(d.SeamAllowancePoints(pattern), d.getSeamAllowance());
|
||||||
det.setName(idetail.value().getName());
|
det.setName(d.getName());
|
||||||
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
det.setWidth(qApp->toPixel(d.getWidth()));
|
||||||
|
|
||||||
listDetails.append(det);
|
listDetails.append(det);
|
||||||
}
|
}
|
||||||
|
@ -935,20 +935,21 @@ void MainWindowsNoGUI::UnitePages()
|
||||||
for (int i = 0; i < papers.size(); ++i)
|
for (int i = 0; i < papers.size(); ++i)
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
SCASSERT(paper != nullptr)
|
SCASSERT(paper != nullptr);
|
||||||
if (length + paper->rect().height() <= QIMAGE_MAX)
|
const QRectF rec = paper->rect();
|
||||||
|
if (length + rec.height() <= QIMAGE_MAX)
|
||||||
{
|
{
|
||||||
UniteDetails(j, nDetails, length, i);
|
UniteDetails(j, nDetails, length, i);
|
||||||
length += paper->rect().height();
|
length += rec.height();
|
||||||
UnitePapers(j, nPapers, paper->rect().width(), length);
|
UnitePapers(j, nPapers, rec.width(), length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
length = 0; // Strat new paper
|
length = 0; // Strat new paper
|
||||||
++j;// New paper
|
++j;// New paper
|
||||||
UniteDetails(j, nDetails, length, i);
|
UniteDetails(j, nDetails, length, i);
|
||||||
length += paper->rect().height();
|
length += rec.height();
|
||||||
UnitePapers(j, nPapers, paper->rect().width(), length);
|
UnitePapers(j, nPapers, rec.width(), length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ void VPattern::setCurrentData()
|
||||||
*/
|
*/
|
||||||
void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); //-V712 //-V654
|
||||||
SCASSERT(data != nullptr);
|
SCASSERT(data != nullptr);
|
||||||
ToolExists(id);
|
ToolExists(id);
|
||||||
VDataTool *tool = tools.value(id);
|
VDataTool *tool = tools.value(id);
|
||||||
|
@ -355,7 +355,7 @@ void VPattern::LiteParseTree(const Document &parse)
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
|
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
emit SetEnabledGUI(false);
|
emit SetEnabledGUI(false);
|
||||||
if (not VApplication::CheckGUI())
|
if (not VApplication::CheckGUI())
|
||||||
|
@ -548,7 +548,7 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
|
||||||
*/
|
*/
|
||||||
void VPattern::ParseDetailElement(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseDetailElement(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VDetail detail;
|
VDetail detail;
|
||||||
|
@ -620,7 +620,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
*/
|
*/
|
||||||
void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
QDomNode domNode = domElement.firstChild();
|
QDomNode domNode = domElement.firstChild();
|
||||||
while (domNode.isNull() == false)
|
while (domNode.isNull() == false)
|
||||||
{
|
{
|
||||||
|
@ -675,8 +675,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
const Document &parse, const QString &type)
|
const Document &parse, const QString &type)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
|
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
|
||||||
|
|
||||||
QStringList points = QStringList() << VToolBasePoint::ToolType /*0*/
|
QStringList points = QStringList() << VToolBasePoint::ToolType /*0*/
|
||||||
<< VToolEndLine::ToolType /*1*/
|
<< VToolEndLine::ToolType /*1*/
|
||||||
|
@ -785,7 +785,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
|
@ -904,7 +904,7 @@ QString VPattern::GetLabelBase(quint32 index) const
|
||||||
void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
VToolBasePoint *spoint = 0;
|
VToolBasePoint *spoint = 0;
|
||||||
try
|
try
|
||||||
|
@ -949,7 +949,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
|
||||||
void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -998,7 +998,7 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
|
||||||
void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1042,7 +1042,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
|
||||||
void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1087,7 +1087,7 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do
|
||||||
void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1132,7 +1132,7 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1177,7 +1177,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1207,7 +1207,7 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme
|
||||||
void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1249,7 +1249,7 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1277,7 +1277,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
|
||||||
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1308,7 +1308,7 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom
|
||||||
void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1339,7 +1339,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1367,7 +1367,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
|
||||||
void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1410,7 +1410,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
|
||||||
void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1454,7 +1454,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
|
||||||
void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1496,7 +1496,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1546,7 +1546,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1594,7 +1594,7 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1626,7 +1626,7 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1668,7 +1668,7 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1708,7 +1708,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
|
||||||
const Document &parse)
|
const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1739,7 +1739,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
|
||||||
void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1781,7 +1781,7 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
|
||||||
void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1812,7 +1812,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &dom
|
||||||
void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1864,7 +1864,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1890,7 +1890,7 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1960,7 +1960,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2145,8 +2145,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
const QString &type)
|
const QString &type)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty");
|
||||||
|
|
||||||
QStringList arcs = QStringList() << VToolArc::ToolType /*0*/
|
QStringList arcs = QStringList() << VToolArc::ToolType /*0*/
|
||||||
<< VNodeArc::ToolType /*1*/
|
<< VNodeArc::ToolType /*1*/
|
||||||
|
@ -2604,7 +2604,7 @@ QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const
|
||||||
*/
|
*/
|
||||||
void VPattern::IncrementReferens(quint32 id) const
|
void VPattern::IncrementReferens(quint32 id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0");
|
||||||
ToolExists(id);
|
ToolExists(id);
|
||||||
VDataTool *tool = tools.value(id);
|
VDataTool *tool = tools.value(id);
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
|
@ -2618,7 +2618,7 @@ void VPattern::IncrementReferens(quint32 id) const
|
||||||
*/
|
*/
|
||||||
void VPattern::DecrementReferens(quint32 id) const
|
void VPattern::DecrementReferens(quint32 id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0");
|
||||||
ToolExists(id);
|
ToolExists(id);
|
||||||
VDataTool *tool = tools.value(id);
|
VDataTool *tool = tools.value(id);
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
*/
|
*/
|
||||||
VException::VException(const QString &what):QException(), what(what), moreInfo(QString())
|
VException::VException(const QString &what):QException(), what(what), moreInfo(QString())
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(what.isEmpty() == false, Q_FUNC_INFO, "Error message is empty");
|
Q_ASSERT_X(not what.isEmpty(), Q_FUNC_INFO, "Error message is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
VExceptionConversionError::VExceptionConversionError(const QString &what, const QString &str)
|
VExceptionConversionError::VExceptionConversionError(const QString &what, const QString &str)
|
||||||
:VException(what), str(str)
|
:VException(what), str(str)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(str.isEmpty() == false, Q_FUNC_INFO, "Error converting string is empty");
|
Q_ASSERT_X(not str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -41,8 +41,8 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS
|
||||||
const QDomElement &domElement)
|
const QDomElement &domElement)
|
||||||
: VException(what), name(name), tagText(QString()), tagName(QString()), lineNumber(-1)
|
: VException(what), name(name), tagText(QString()), tagName(QString()), lineNumber(-1)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "Parameter name is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty");
|
||||||
QTextStream stream(&tagText);
|
QTextStream stream(&tagText);
|
||||||
domElement.save(stream, 4);
|
domElement.save(stream, 4);
|
||||||
tagName = domElement.tagName();
|
tagName = domElement.tagName();
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement)
|
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement)
|
||||||
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
|
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
QTextStream stream(&tagText);
|
QTextStream stream(&tagText);
|
||||||
domElement.save(stream, 4);
|
domElement.save(stream, 4);
|
||||||
tagName = domElement.tagName();
|
tagName = domElement.tagName();
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement)
|
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement)
|
||||||
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
|
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
QTextStream stream(&tagText);
|
QTextStream stream(&tagText);
|
||||||
domElement.save(stream, 4);
|
domElement.save(stream, 4);
|
||||||
tagName = domElement.tagName();
|
tagName = domElement.tagName();
|
||||||
|
|
|
@ -170,7 +170,7 @@ QStringList VAbstractPattern::ListMeasurements() const
|
||||||
*/
|
*/
|
||||||
void VAbstractPattern::ChangeActivPP(const QString &name, const Document &parse)
|
void VAbstractPattern::ChangeActivPP(const QString &name, const Document &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "ChangeActivPP", "name pattern piece is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty");
|
||||||
if (CheckExistNamePP(name) && this->nameActivPP != name)
|
if (CheckExistNamePP(name) && this->nameActivPP != name)
|
||||||
{
|
{
|
||||||
this->nameActivPP = name;
|
this->nameActivPP = name;
|
||||||
|
@ -231,7 +231,7 @@ bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::CheckExistNamePP(const QString &name) const
|
bool VAbstractPattern::CheckExistNamePP(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty");
|
||||||
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
||||||
if (elements.size() == 0)
|
if (elements.size() == 0)
|
||||||
{
|
{
|
||||||
|
@ -260,7 +260,7 @@ bool VAbstractPattern::CheckExistNamePP(const QString &name) const
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::GetActivNodeElement(const QString &name, QDomElement &element) const
|
bool VAbstractPattern::GetActivNodeElement(const QString &name, QDomElement &element) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty");
|
||||||
QDomElement drawElement;
|
QDomElement drawElement;
|
||||||
if (GetActivDrawElement(drawElement))
|
if (GetActivDrawElement(drawElement))
|
||||||
{
|
{
|
||||||
|
@ -328,8 +328,8 @@ QDomElement VAbstractPattern::GetPPElement(const QString &name)
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newName)
|
bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newName)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(newName.isEmpty() == false, "SetNamePP", "new name pattern piece is empty");
|
Q_ASSERT_X(not newName.isEmpty(), Q_FUNC_INFO, "new name pattern piece is empty");
|
||||||
Q_ASSERT_X(oldName.isEmpty() == false, "SetNamePP", "old name pattern piece is empty");
|
Q_ASSERT_X(not oldName.isEmpty(), Q_FUNC_INFO, "old name pattern piece is empty");
|
||||||
|
|
||||||
if (CheckExistNamePP(oldName) == false)
|
if (CheckExistNamePP(oldName) == false)
|
||||||
{
|
{
|
||||||
|
@ -373,7 +373,7 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::appendPP(const QString &name)
|
bool VAbstractPattern::appendPP(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "appendPP", "name pattern piece is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty");
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -422,7 +422,7 @@ VDataTool *VAbstractPattern::getTool(const quint32 &id)
|
||||||
*/
|
*/
|
||||||
void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool)
|
void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0");
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
tools.insert(id, tool);
|
tools.insert(id, tool);
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ void VAbstractPattern::ToolExists(const quint32 &id) const
|
||||||
*/
|
*/
|
||||||
void VAbstractPattern::SetActivPP(const QString &name)
|
void VAbstractPattern::SetActivPP(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "SetActivPP", "name pattern piece is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty");
|
||||||
this->nameActivPP = name;
|
this->nameActivPP = name;
|
||||||
emit ChangedActivPP(name);
|
emit ChangedActivPP(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,8 +203,8 @@ bool VDomDocument::find(const QDomElement &node, const QString& id)
|
||||||
*/
|
*/
|
||||||
quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const
|
quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString parametr;
|
QString parametr;
|
||||||
|
@ -233,8 +233,8 @@ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QStri
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString &name, const QString &defValue) const
|
bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString &name, const QString &defValue) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
QString parametr;
|
QString parametr;
|
||||||
bool val = true;
|
bool val = true;
|
||||||
|
@ -279,8 +279,8 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
|
||||||
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name,
|
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name,
|
||||||
const QString &defValue) const
|
const QString &defValue) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
const QString parameter = domElement.attribute(name, defValue);
|
const QString parameter = domElement.attribute(name, defValue);
|
||||||
if (parameter.isEmpty())
|
if (parameter.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -305,8 +305,8 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt
|
||||||
*/
|
*/
|
||||||
qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const
|
qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
qreal param = 0;
|
qreal param = 0;
|
||||||
|
@ -338,7 +338,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri
|
||||||
*/
|
*/
|
||||||
quint32 VDomDocument::GetParametrId(const QDomElement &domElement) const
|
quint32 VDomDocument::GetParametrId(const QDomElement &domElement) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
|
|
||||||
|
|
|
@ -841,13 +841,13 @@ void QmuParserBase::ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type>
|
||||||
while (a_stOpt.size() && a_stOpt.top().GetCode()==cmELSE)
|
while (a_stOpt.size() && a_stOpt.top().GetCode()==cmELSE)
|
||||||
{
|
{
|
||||||
token_type opElse = a_stOpt.pop();
|
token_type opElse = a_stOpt.pop();
|
||||||
Q_ASSERT(a_stOpt.size()>0);
|
Q_ASSERT(a_stOpt.size()>0); //-V654
|
||||||
|
|
||||||
// Take the value associated with the else branch from the value stack
|
// Take the value associated with the else branch from the value stack
|
||||||
token_type vVal2 = a_stVal.pop();
|
token_type vVal2 = a_stVal.pop();
|
||||||
|
|
||||||
Q_ASSERT(a_stOpt.size()>0);
|
Q_ASSERT(a_stOpt.size()>0); //-V654
|
||||||
Q_ASSERT(a_stVal.size()>=2);
|
Q_ASSERT(a_stVal.size()>=2); //-V654
|
||||||
|
|
||||||
// it then else is a ternary operator Pop all three values from the value s
|
// it then else is a ternary operator Pop all three values from the value s
|
||||||
// tack and just return the right value
|
// tack and just return the right value
|
||||||
|
@ -857,8 +857,8 @@ void QmuParserBase::ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type>
|
||||||
a_stVal.push( (qFuzzyCompare(vExpr.GetVal()+1, 1+0)==false) ? vVal1 : vVal2);
|
a_stVal.push( (qFuzzyCompare(vExpr.GetVal()+1, 1+0)==false) ? vVal1 : vVal2);
|
||||||
|
|
||||||
token_type opIf = a_stOpt.pop();
|
token_type opIf = a_stOpt.pop();
|
||||||
Q_ASSERT(opElse.GetCode()==cmELSE);
|
Q_ASSERT(opElse.GetCode()==cmELSE); //-V654
|
||||||
Q_ASSERT(opIf.GetCode()==cmIF);
|
Q_ASSERT(opIf.GetCode()==cmIF); //-V654
|
||||||
|
|
||||||
m_vRPN.AddIfElse(cmENDIF);
|
m_vRPN.AddIfElse(cmENDIF);
|
||||||
} // while pending if-else-clause found
|
} // while pending if-else-clause found
|
||||||
|
@ -877,7 +877,7 @@ void QmuParserBase::ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Q_ASSERT(a_stVal.size()>=2);
|
Q_ASSERT(a_stVal.size()>=2); //-V654
|
||||||
token_type valTok1 = a_stVal.pop(),
|
token_type valTok1 = a_stVal.pop(),
|
||||||
valTok2 = a_stVal.pop(),
|
valTok2 = a_stVal.pop(),
|
||||||
optTok = a_stOpt.pop(),
|
optTok = a_stOpt.pop(),
|
||||||
|
@ -913,14 +913,12 @@ void QmuParserBase::ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type>
|
||||||
*/
|
*/
|
||||||
void QmuParserBase::ApplyRemainingOprt(QStack<token_type> &stOpt, QStack<token_type> &stVal) const
|
void QmuParserBase::ApplyRemainingOprt(QStack<token_type> &stOpt, QStack<token_type> &stVal) const
|
||||||
{
|
{
|
||||||
while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmIF)
|
const ECmdCode code = stOpt.top().GetCode();
|
||||||
|
while (stOpt.size() && code != cmBO && code != cmIF)
|
||||||
{
|
{
|
||||||
token_type tok = stOpt.top();
|
|
||||||
const ECmdCode code = tok.GetCode();
|
|
||||||
|
|
||||||
if ((code >= cmLE && code <= cmASSIGN) || code == cmOPRT_INFIX || code == cmOPRT_BIN)
|
if ((code >= cmLE && code <= cmASSIGN) || code == cmOPRT_INFIX || code == cmOPRT_BIN)
|
||||||
{
|
{
|
||||||
if (stOpt.top().GetCode()==cmOPRT_INFIX)
|
if (code==cmOPRT_INFIX)
|
||||||
{
|
{
|
||||||
ApplyFunc(stOpt, stVal, 1);
|
ApplyFunc(stOpt, stVal, 1);
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1175,7 @@ qreal QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
|
||||||
|
|
||||||
// The index of the string argument in the string table
|
// The index of the string argument in the string table
|
||||||
int iIdxStack = pTok->Fun.idx;
|
int iIdxStack = pTok->Fun.idx;
|
||||||
Q_ASSERT( iIdxStack>=0 && iIdxStack<m_vStringBuf.size() );
|
Q_ASSERT( iIdxStack>=0 && iIdxStack<m_vStringBuf.size() ); //-V654
|
||||||
|
|
||||||
switch (pTok->Fun.argc) // switch according to argument count
|
switch (pTok->Fun.argc) // switch according to argument count
|
||||||
{
|
{
|
||||||
|
@ -1332,21 +1330,30 @@ void QmuParserBase::CreateRPN() const
|
||||||
// Next three are different kind of value entries
|
// Next three are different kind of value entries
|
||||||
//
|
//
|
||||||
case cmSTRING:
|
case cmSTRING:
|
||||||
|
{
|
||||||
opt.SetIdx(m_vStringBuf.size()); // Assign buffer index to token
|
opt.SetIdx(m_vStringBuf.size()); // Assign buffer index to token
|
||||||
stVal.push(opt);
|
stVal.push(opt);
|
||||||
m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer
|
const QString &str = opt.GetAsString();
|
||||||
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
|
m_vStringBuf.push_back(str); // Store string in internal buffer
|
||||||
|
m_Tokens.insert(m_pTokenReader->GetPos()-str.length(), str);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case cmVAR:
|
case cmVAR:
|
||||||
|
{
|
||||||
stVal.push(opt);
|
stVal.push(opt);
|
||||||
m_vRPN.AddVar( static_cast<qreal*>(opt.GetVar()) );
|
m_vRPN.AddVar( static_cast<qreal*>(opt.GetVar()) );
|
||||||
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
|
const QString &str = opt.GetAsString();
|
||||||
|
m_Tokens.insert(m_pTokenReader->GetPos()-str.length(), str);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case cmVAL:
|
case cmVAL:
|
||||||
|
{
|
||||||
stVal.push(opt);
|
stVal.push(opt);
|
||||||
m_vRPN.AddVal( opt.GetVal() );
|
m_vRPN.AddVal( opt.GetVal() );
|
||||||
m_Numbers.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
|
const QString &str = opt.GetAsString();
|
||||||
|
m_Numbers.insert(m_pTokenReader->GetPos()-str.length(), str);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case cmELSE:
|
case cmELSE:
|
||||||
m_nIfElseCounter--;
|
m_nIfElseCounter--;
|
||||||
if (m_nIfElseCounter<0)
|
if (m_nIfElseCounter<0)
|
||||||
|
@ -1388,7 +1395,8 @@ void QmuParserBase::CreateRPN() const
|
||||||
ApplyRemainingOprt(stOpt, stVal);
|
ApplyRemainingOprt(stOpt, stVal);
|
||||||
|
|
||||||
// Check if the bracket content has been evaluated completely
|
// Check if the bracket content has been evaluated completely
|
||||||
if (stOpt.size() && stOpt.top().GetCode()==cmBO)
|
token_type &topToken = stOpt.top();
|
||||||
|
if (stOpt.size() && topToken.GetCode()==cmBO)
|
||||||
{
|
{
|
||||||
// if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check
|
// if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check
|
||||||
// if there is either a function or a sign pending
|
// if there is either a function or a sign pending
|
||||||
|
@ -1401,17 +1409,17 @@ void QmuParserBase::CreateRPN() const
|
||||||
|
|
||||||
stOpt.pop(); // Take opening bracket from stack
|
stOpt.pop(); // Take opening bracket from stack
|
||||||
|
|
||||||
if (iArgCount>1 && ( stOpt.size()==0 || (stOpt.top().GetCode()!=cmFUNC &&
|
if (iArgCount>1 && ( stOpt.size()==0 || (topToken.GetCode()!=cmFUNC &&
|
||||||
stOpt.top().GetCode()!=cmFUNC_BULK &&
|
topToken.GetCode()!=cmFUNC_BULK &&
|
||||||
stOpt.top().GetCode()!=cmFUNC_STR) ) )
|
topToken.GetCode()!=cmFUNC_STR) ) )
|
||||||
{
|
{
|
||||||
Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
|
Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The opening bracket was popped from the stack now check if there
|
// The opening bracket was popped from the stack now check if there
|
||||||
// was a function before this bracket
|
// was a function before this bracket
|
||||||
if (stOpt.size() && stOpt.top().GetCode()!=cmOPRT_INFIX && stOpt.top().GetCode()!=cmOPRT_BIN &&
|
if (stOpt.size() && topToken.GetCode()!=cmOPRT_INFIX && topToken.GetCode()!=cmOPRT_BIN &&
|
||||||
stOpt.top().GetFuncAddr()!=0)
|
topToken.GetFuncAddr()!=0)
|
||||||
{
|
{
|
||||||
ApplyFunc(stOpt, stVal, iArgCount);
|
ApplyFunc(stOpt, stVal, iArgCount);
|
||||||
}
|
}
|
||||||
|
@ -1445,14 +1453,16 @@ void QmuParserBase::CreateRPN() const
|
||||||
case cmLOR:
|
case cmLOR:
|
||||||
case cmASSIGN:
|
case cmASSIGN:
|
||||||
case cmOPRT_BIN:
|
case cmOPRT_BIN:
|
||||||
// A binary operator (user defined or built in) has been found.
|
|
||||||
while ( stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmELSE &&
|
|
||||||
stOpt.top().GetCode() != cmIF)
|
|
||||||
{
|
{
|
||||||
int nPrec1 = GetOprtPrecedence(stOpt.top()),
|
const token_type &topToken = stOpt.top();
|
||||||
|
// A binary operator (user defined or built in) has been found.
|
||||||
|
while ( stOpt.size() && topToken.GetCode() != cmBO && topToken.GetCode() != cmELSE &&
|
||||||
|
topToken.GetCode() != cmIF)
|
||||||
|
{
|
||||||
|
int nPrec1 = GetOprtPrecedence(topToken),
|
||||||
nPrec2 = GetOprtPrecedence(opt);
|
nPrec2 = GetOprtPrecedence(opt);
|
||||||
|
|
||||||
if (stOpt.top().GetCode()==opt.GetCode())
|
if (topToken.GetCode()==opt.GetCode())
|
||||||
{
|
{
|
||||||
// Deal with operator associativity
|
// Deal with operator associativity
|
||||||
EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
|
EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
|
||||||
|
@ -1467,7 +1477,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
// In case the operators are not equal the precedence decides alone...
|
// In case the operators are not equal the precedence decides alone...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (stOpt.top().GetCode()==cmOPRT_INFIX)
|
if (topToken.GetCode()==cmOPRT_INFIX)
|
||||||
{
|
{
|
||||||
ApplyFunc(stOpt, stVal, 1);
|
ApplyFunc(stOpt, stVal, 1);
|
||||||
}
|
}
|
||||||
|
@ -1485,6 +1495,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
// The operator can't be evaluated right now, push back to the operator stack
|
// The operator can't be evaluated right now, push back to the operator stack
|
||||||
stOpt.push(opt);
|
stOpt.push(opt);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Last section contains functions and operators implicitely mapped to functions
|
// Last section contains functions and operators implicitely mapped to functions
|
||||||
//
|
//
|
||||||
|
@ -1541,7 +1552,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the last value (= final result) from the stack
|
// get the last value (= final result) from the stack
|
||||||
Q_ASSERT(stArgCount.size()==1);
|
Q_ASSERT(stArgCount.size()==1); //-V654
|
||||||
m_nFinalResultIdx = stArgCount.top();
|
m_nFinalResultIdx = stArgCount.top();
|
||||||
if (m_nFinalResultIdx==0)
|
if (m_nFinalResultIdx==0)
|
||||||
{
|
{
|
||||||
|
@ -1788,13 +1799,14 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
|
||||||
|
|
||||||
while ( stOprt.empty() == false )
|
while ( stOprt.empty() == false )
|
||||||
{
|
{
|
||||||
if (stOprt.top().GetCode()<=cmASSIGN)
|
const token_type &topToken = stOprt.top();
|
||||||
|
if (topToken.GetCode()<=cmASSIGN)
|
||||||
{
|
{
|
||||||
qDebug() << "OPRT_INTRNL \"" << QmuParserBase::c_DefaultOprt[stOprt.top().GetCode()] << "\" \n";
|
qDebug() << "OPRT_INTRNL \"" << QmuParserBase::c_DefaultOprt[topToken.GetCode()] << "\" \n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch ( stOprt.top().GetCode())
|
switch ( topToken.GetCode())
|
||||||
{
|
{
|
||||||
case cmVAR:
|
case cmVAR:
|
||||||
qDebug() << "VAR\n";
|
qDebug() << "VAR\n";
|
||||||
|
@ -1803,16 +1815,16 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
|
||||||
qDebug() << "VAL\n";
|
qDebug() << "VAL\n";
|
||||||
break;
|
break;
|
||||||
case cmFUNC:
|
case cmFUNC:
|
||||||
qDebug() << "FUNC \"" << stOprt.top().GetAsString() << "\"\n";
|
qDebug() << "FUNC \"" << topToken.GetAsString() << "\"\n";
|
||||||
break;
|
break;
|
||||||
case cmFUNC_BULK:
|
case cmFUNC_BULK:
|
||||||
qDebug() << "FUNC_BULK \"" << stOprt.top().GetAsString() << "\"\n";
|
qDebug() << "FUNC_BULK \"" << topToken.GetAsString() << "\"\n";
|
||||||
break;
|
break;
|
||||||
case cmOPRT_INFIX:
|
case cmOPRT_INFIX:
|
||||||
qDebug() << "OPRT_INFIX \"" << stOprt.top().GetAsString() << "\"\n";
|
qDebug() << "OPRT_INFIX \"" << topToken.GetAsString() << "\"\n";
|
||||||
break;
|
break;
|
||||||
case cmOPRT_BIN:
|
case cmOPRT_BIN:
|
||||||
qDebug() << "OPRT_BIN \"" << stOprt.top().GetAsString() << "\"\n";
|
qDebug() << "OPRT_BIN \"" << topToken.GetAsString() << "\"\n";
|
||||||
break;
|
break;
|
||||||
case cmFUNC_STR:
|
case cmFUNC_STR:
|
||||||
qDebug() << "FUNC_STR\n";
|
qDebug() << "FUNC_STR\n";
|
||||||
|
@ -1839,7 +1851,7 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
|
||||||
qDebug() << "ENDIF\n";
|
qDebug() << "ENDIF\n";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug() << stOprt.top().GetCode() << " ";
|
qDebug() << topToken.GetCode() << " ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
|
||||||
// cmVAL cmVAL cmADD
|
// cmVAL cmVAL cmADD
|
||||||
// where cmADD can stand fopr any binary operator applied to
|
// where cmADD can stand fopr any binary operator applied to
|
||||||
// two constant values.
|
// two constant values.
|
||||||
if (sz>=2 && m_vRPN[sz-2].Cmd == cmVAL && m_vRPN[sz-1].Cmd == cmVAL)
|
if (sz>=2 && m_vRPN.at(sz-2).Cmd == cmVAL && m_vRPN.at(sz-1).Cmd == cmVAL)
|
||||||
{
|
{
|
||||||
ConstantFolding(a_Oprt);
|
ConstantFolding(a_Oprt);
|
||||||
bOptimized = true;
|
bOptimized = true;
|
||||||
|
@ -243,17 +243,17 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
|
||||||
{
|
{
|
||||||
case cmPOW:
|
case cmPOW:
|
||||||
// Optimization for ploynomials of low order
|
// Optimization for ploynomials of low order
|
||||||
if (m_vRPN[sz-2].Cmd == cmVAR && m_vRPN[sz-1].Cmd == cmVAL)
|
if (m_vRPN.at(sz-2).Cmd == cmVAR && m_vRPN.at(sz-1).Cmd == cmVAL) //-V807
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(m_vRPN[sz-1].Val.data2, 2))
|
if (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2, 2)) //-V807
|
||||||
{
|
{
|
||||||
m_vRPN[sz-2].Cmd = cmVARPOW2;
|
m_vRPN[sz-2].Cmd = cmVARPOW2;
|
||||||
}
|
}
|
||||||
else if (qFuzzyCompare(m_vRPN[sz-1].Val.data2, 3))
|
else if (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2, 3))
|
||||||
{
|
{
|
||||||
m_vRPN[sz-2].Cmd = cmVARPOW3;
|
m_vRPN[sz-2].Cmd = cmVARPOW3;
|
||||||
}
|
}
|
||||||
else if (qFuzzyCompare(m_vRPN[sz-1].Val.data2, 4))
|
else if (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2, 4))
|
||||||
{
|
{
|
||||||
m_vRPN[sz-2].Cmd = cmVARPOW4;
|
m_vRPN[sz-2].Cmd = cmVARPOW4;
|
||||||
}
|
}
|
||||||
|
@ -270,69 +270,69 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
|
||||||
case cmADD:
|
case cmADD:
|
||||||
// Simple optimization based on pattern recognition for a shitload of different
|
// Simple optimization based on pattern recognition for a shitload of different
|
||||||
// bytecode combinations of addition/subtraction
|
// bytecode combinations of addition/subtraction
|
||||||
if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) ||
|
if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) ||
|
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) ||
|
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) ||
|
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAL) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR &&
|
(m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAR &&
|
||||||
m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
|
m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) || //-V807
|
||||||
(m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVARMUL
|
(m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVARMUL
|
||||||
&& m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
|
&& m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAR &&
|
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAR &&
|
||||||
m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
|
m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVARMUL &&
|
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
|
||||||
m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) )
|
m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) )
|
||||||
{
|
{
|
||||||
assert( (m_vRPN[sz-2].Val.ptr==nullptr && m_vRPN[sz-1].Val.ptr!=nullptr) ||
|
assert( (m_vRPN.at(sz-2).Val.ptr==nullptr && m_vRPN.at(sz-1).Val.ptr!=nullptr) ||
|
||||||
(m_vRPN[sz-2].Val.ptr!=nullptr && m_vRPN[sz-1].Val.ptr==nullptr) ||
|
(m_vRPN.at(sz-2).Val.ptr!=nullptr && m_vRPN.at(sz-1).Val.ptr==nullptr) ||
|
||||||
(m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) );
|
(m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) );
|
||||||
|
|
||||||
m_vRPN[sz-2].Cmd = cmVARMUL;
|
m_vRPN[sz-2].Cmd = cmVARMUL;
|
||||||
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
|
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>( //-V807
|
||||||
reinterpret_cast<qlonglong>(m_vRPN[sz-2].Val.ptr) |
|
reinterpret_cast<qlonglong>(m_vRPN.at(sz-2).Val.ptr) |
|
||||||
reinterpret_cast<qlonglong>(m_vRPN[sz-1].Val.ptr)); // variable
|
reinterpret_cast<qlonglong>(m_vRPN.at(sz-1).Val.ptr)); // variable
|
||||||
m_vRPN[sz-2].Val.data2 += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data2; // offset
|
m_vRPN[sz-2].Val.data2 += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN.at(sz-1).Val.data2; // offset
|
||||||
m_vRPN[sz-2].Val.data += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data; // multiplikatior
|
m_vRPN[sz-2].Val.data += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN.at(sz-1).Val.data; // multiplikatior
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
bOptimized = true;
|
bOptimized = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cmMUL:
|
case cmMUL:
|
||||||
if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) ||
|
if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) )
|
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) )
|
||||||
{
|
{
|
||||||
m_vRPN[sz-2].Cmd = cmVARMUL;
|
m_vRPN[sz-2].Cmd = cmVARMUL;
|
||||||
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
|
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
|
||||||
reinterpret_cast<qlonglong>(m_vRPN[sz-2].Val.ptr) |
|
reinterpret_cast<qlonglong>(m_vRPN.at(sz-2).Val.ptr) |
|
||||||
reinterpret_cast<qlonglong>(m_vRPN[sz-1].Val.ptr));
|
reinterpret_cast<qlonglong>(m_vRPN.at(sz-1).Val.ptr));
|
||||||
m_vRPN[sz-2].Val.data = m_vRPN[sz-2].Val.data2 + m_vRPN[sz-1].Val.data2;
|
m_vRPN[sz-2].Val.data = m_vRPN.at(sz-2).Val.data2 + m_vRPN.at(sz-1).Val.data2;
|
||||||
m_vRPN[sz-2].Val.data2 = 0;
|
m_vRPN[sz-2].Val.data2 = 0;
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
bOptimized = true;
|
bOptimized = true;
|
||||||
}
|
}
|
||||||
else if ( (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) ||
|
else if ( (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL) ||
|
||||||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) )
|
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAL) )
|
||||||
{
|
{
|
||||||
// Optimization: 2*(3*b+1) or (3*b+1)*2 -> 6*b+2
|
// Optimization: 2*(3*b+1) or (3*b+1)*2 -> 6*b+2
|
||||||
m_vRPN[sz-2].Cmd = cmVARMUL;
|
m_vRPN[sz-2].Cmd = cmVARMUL;
|
||||||
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
|
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
|
||||||
reinterpret_cast<qlonglong>(m_vRPN[sz-2].Val.ptr) |
|
reinterpret_cast<qlonglong>(m_vRPN.at(sz-2).Val.ptr) |
|
||||||
reinterpret_cast<qlonglong>(m_vRPN[sz-1].Val.ptr));
|
reinterpret_cast<qlonglong>(m_vRPN.at(sz-1).Val.ptr));
|
||||||
if (m_vRPN[sz-1].Cmd == cmVAL)
|
if (m_vRPN.at(sz-1).Cmd == cmVAL)
|
||||||
{
|
{
|
||||||
m_vRPN[sz-2].Val.data *= m_vRPN[sz-1].Val.data2;
|
m_vRPN[sz-2].Val.data *= m_vRPN.at(sz-1).Val.data2;
|
||||||
m_vRPN[sz-2].Val.data2 *= m_vRPN[sz-1].Val.data2;
|
m_vRPN[sz-2].Val.data2 *= m_vRPN.at(sz-1).Val.data2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_vRPN[sz-2].Val.data = m_vRPN[sz-1].Val.data * m_vRPN[sz-2].Val.data2;
|
m_vRPN[sz-2].Val.data = m_vRPN.at(sz-1).Val.data * m_vRPN.at(sz-2).Val.data2;
|
||||||
m_vRPN[sz-2].Val.data2 = m_vRPN[sz-1].Val.data2 * m_vRPN[sz-2].Val.data2;
|
m_vRPN[sz-2].Val.data2 = m_vRPN.at(sz-1).Val.data2 * m_vRPN.at(sz-2).Val.data2;
|
||||||
}
|
}
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
bOptimized = true;
|
bOptimized = true;
|
||||||
}
|
}
|
||||||
else if (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR &&
|
else if (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAR &&
|
||||||
m_vRPN[sz-1].Val.ptr == m_vRPN[sz-2].Val.ptr)
|
m_vRPN.at(sz-1).Val.ptr == m_vRPN.at(sz-2).Val.ptr)
|
||||||
{
|
{
|
||||||
// Optimization: a*a -> a^2
|
// Optimization: a*a -> a^2
|
||||||
m_vRPN[sz-2].Cmd = cmVARPOW2;
|
m_vRPN[sz-2].Cmd = cmVARPOW2;
|
||||||
|
@ -341,12 +341,12 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cmDIV:
|
case cmDIV:
|
||||||
if (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL &&
|
if (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
|
||||||
(qFuzzyCompare(m_vRPN[sz-1].Val.data2+1, 1+0)==false))
|
(qFuzzyCompare(m_vRPN.at(sz-1).Val.data2+1, 1+0)==false))
|
||||||
{
|
{
|
||||||
// Optimization: 4*a/2 -> 2*a
|
// Optimization: 4*a/2 -> 2*a
|
||||||
m_vRPN[sz-2].Val.data /= m_vRPN[sz-1].Val.data2;
|
m_vRPN[sz-2].Val.data /= m_vRPN.at(sz-1).Val.data2;
|
||||||
m_vRPN[sz-2].Val.data2 /= m_vRPN[sz-1].Val.data2;
|
m_vRPN[sz-2].Val.data2 /= m_vRPN.at(sz-1).Val.data2;
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
bOptimized = true;
|
bOptimized = true;
|
||||||
}
|
}
|
||||||
|
@ -550,37 +550,37 @@ void QmuParserByteCode::AsciiDump()
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Number of RPN tokens:" << m_vRPN.size() << "\n";
|
qDebug() << "Number of RPN tokens:" << m_vRPN.size() << "\n";
|
||||||
for (int i=0; i<m_vRPN.size() && m_vRPN[i].Cmd!=cmEND; ++i)
|
for (int i=0; i<m_vRPN.size() && m_vRPN.at(i).Cmd!=cmEND; ++i)
|
||||||
{
|
{
|
||||||
qDebug() << i << " : \t";
|
qDebug() << i << " : \t";
|
||||||
switch (m_vRPN[i].Cmd)
|
switch (m_vRPN.at(i).Cmd)
|
||||||
{
|
{
|
||||||
case cmVAL:
|
case cmVAL:
|
||||||
qDebug() << "VAL \t" << "[" << m_vRPN[i].Val.data2 << "]\n";
|
qDebug() << "VAL \t" << "[" << m_vRPN.at(i).Val.data2 << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmVAR:
|
case cmVAR:
|
||||||
qDebug() << "VAR \t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Val.ptr, 'f', 16) << "]\n";
|
qDebug() << "VAR \t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Val.ptr, 'f', 16) << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmVARPOW2:
|
case cmVARPOW2:
|
||||||
qDebug() << "VARPOW2 \t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Val.ptr, 'f', 16) << "]\n";
|
qDebug() << "VARPOW2 \t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Val.ptr, 'f', 16) << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmVARPOW3:
|
case cmVARPOW3:
|
||||||
qDebug() << "VARPOW3 \t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Val.ptr, 'f', 16) << "]\n";
|
qDebug() << "VARPOW3 \t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Val.ptr, 'f', 16) << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmVARPOW4:
|
case cmVARPOW4:
|
||||||
qDebug() << "VARPOW4 \t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Val.ptr, 'f', 16) << "]\n";
|
qDebug() << "VARPOW4 \t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Val.ptr, 'f', 16) << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmVARMUL:
|
case cmVARMUL:
|
||||||
qDebug() << "VARMUL \t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Val.ptr, 'f', 16) << "]" << " * ["
|
qDebug() << "VARMUL \t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Val.ptr, 'f', 16) << "]" << " * [" //-V807
|
||||||
<< m_vRPN[i].Val.data << "]" << " + [" << m_vRPN[i].Val.data2 << "]\n";
|
<< m_vRPN.at(i).Val.data << "]" << " + [" << m_vRPN.at(i).Val.data2 << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmFUNC:
|
case cmFUNC:
|
||||||
qDebug() << "CALL\t" << "[ARG:" << m_vRPN[i].Fun.argc << "]" << "[ADDR: 0x" << m_vRPN[i].Fun.ptr << "]"
|
qDebug() << "CALL\t" << "[ARG:" << m_vRPN.at(i).Fun.argc << "]" << "[ADDR: 0x" << m_vRPN.at(i).Fun.ptr << "]"
|
||||||
<< "\n";
|
<< "\n";
|
||||||
break;
|
break;
|
||||||
case cmFUNC_STR:
|
case cmFUNC_STR:
|
||||||
qDebug() << "CALL STRFUNC\t" << "[ARG:" << m_vRPN[i].Fun.argc << "]" << "[IDX:" << m_vRPN[i].Fun.idx
|
qDebug() << "CALL STRFUNC\t" << "[ARG:" << m_vRPN.at(i).Fun.argc << "]" << "[IDX:" << m_vRPN.at(i).Fun.idx //-V807
|
||||||
<< "]" << "[ADDR: 0x" << m_vRPN[i].Fun.ptr << "]\n";
|
<< "]" << "[ADDR: 0x" << m_vRPN.at(i).Fun.ptr << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmLT:
|
case cmLT:
|
||||||
qDebug() << "LT\n";
|
qDebug() << "LT\n";
|
||||||
|
@ -622,15 +622,15 @@ void QmuParserByteCode::AsciiDump()
|
||||||
qDebug() << "POW\n";
|
qDebug() << "POW\n";
|
||||||
break;
|
break;
|
||||||
case cmIF:
|
case cmIF:
|
||||||
qDebug() << "IF\t" << "[OFFSET:" << m_vRPN[i].Oprt.offset << "]\n";
|
qDebug() << "IF\t" << "[OFFSET:" << m_vRPN.at(i).Oprt.offset << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmELSE:
|
case cmELSE:
|
||||||
qDebug() << "ELSE\t" << "[OFFSET:" << m_vRPN[i].Oprt.offset << "]\n";
|
qDebug() << "ELSE\t" << "[OFFSET:" << m_vRPN.at(i).Oprt.offset << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmENDIF:
|
case cmENDIF:
|
||||||
qDebug() << "ENDIF\n"; break;
|
qDebug() << "ENDIF\n"; break;
|
||||||
case cmASSIGN:
|
case cmASSIGN:
|
||||||
qDebug() << "ASSIGN\t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Oprt.ptr, 'f', 16) << "]\n";
|
qDebug() << "ASSIGN\t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Oprt.ptr, 'f', 16) << "]\n";
|
||||||
break;
|
break;
|
||||||
case cmBO:
|
case cmBO:
|
||||||
case cmBC:
|
case cmBC:
|
||||||
|
@ -644,7 +644,7 @@ void QmuParserByteCode::AsciiDump()
|
||||||
case cmEND:
|
case cmEND:
|
||||||
case cmUNKNOWN:
|
case cmUNKNOWN:
|
||||||
default:
|
default:
|
||||||
qDebug() << "(unknown code: " << m_vRPN[i].Cmd << ")\n";
|
qDebug() << "(unknown code: " << m_vRPN.at(i).Cmd << ")\n";
|
||||||
break;
|
break;
|
||||||
} // switch cmdCode
|
} // switch cmdCode
|
||||||
} // while bytecode
|
} // while bytecode
|
||||||
|
|
|
@ -120,7 +120,7 @@ int QmuParserTester::TestInterface()
|
||||||
iStat += 1; // not supposed to reach this, nonexisting variable "c" deleted...
|
iStat += 1; // not supposed to reach this, nonexisting variable "c" deleted...
|
||||||
}
|
}
|
||||||
catch ( ... )
|
catch ( ... )
|
||||||
{
|
{ //-V565
|
||||||
// failure is expected...
|
// failure is expected...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ int QmuParserTester::TestNames()
|
||||||
} \
|
} \
|
||||||
catch (QmuParserError &) \
|
catch (QmuParserError &) \
|
||||||
{ \
|
{ \
|
||||||
iErr = (FAIL==false) ? 0 : 1; \
|
iErr = static_cast<int>(FAIL); \
|
||||||
} \
|
} \
|
||||||
iStat += iErr;
|
iStat += iErr;
|
||||||
|
|
||||||
|
@ -1209,7 +1209,7 @@ int QmuParserTester::EqnTestWithVarChange ( const QString &a_str, double a_fVar1
|
||||||
fVal[0] = p.Eval();
|
fVal[0] = p.Eval();
|
||||||
|
|
||||||
// cppcheck-suppress redundantAssignment
|
// cppcheck-suppress redundantAssignment
|
||||||
var = a_fVar2;
|
var = a_fVar2; //-V519
|
||||||
fVal[1] = p.Eval();
|
fVal[1] = p.Eval();
|
||||||
|
|
||||||
if ( fabs ( a_fRes1 - fVal[0] ) > 0.0000000001 )
|
if ( fabs ( a_fRes1 - fVal[0] ) > 0.0000000001 )
|
||||||
|
|
|
@ -80,32 +80,14 @@ DL_Dxf::DL_Dxf()
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
DL_Dxf::~DL_Dxf()
|
DL_Dxf::~DL_Dxf()
|
||||||
{
|
|
||||||
if (vertices!=nullptr)
|
|
||||||
{
|
{
|
||||||
delete[] vertices;
|
delete[] vertices;
|
||||||
}
|
|
||||||
if (knots!=nullptr)
|
|
||||||
{
|
|
||||||
delete[] knots;
|
delete[] knots;
|
||||||
}
|
|
||||||
if (controlPoints!=nullptr)
|
|
||||||
{
|
|
||||||
delete[] controlPoints;
|
delete[] controlPoints;
|
||||||
}
|
|
||||||
if (fitPoints!=nullptr)
|
|
||||||
{
|
|
||||||
delete[] fitPoints;
|
delete[] fitPoints;
|
||||||
}
|
|
||||||
if (weights!=nullptr)
|
|
||||||
{
|
|
||||||
delete[] weights;
|
delete[] weights;
|
||||||
}
|
|
||||||
if (leaderVertices!=nullptr)
|
|
||||||
{
|
|
||||||
delete[] leaderVertices;
|
delete[] leaderVertices;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,7 +252,7 @@ bool DL_Dxf::getStrippedLine(std::string& s, quint32 size, FILE *fp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = "";
|
s.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +323,7 @@ bool DL_Dxf::stripWhiteSpace(char** s)
|
||||||
++(*s);
|
++(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((*s) ? true : false);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -616,7 +598,7 @@ bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface,
|
||||||
// }
|
// }
|
||||||
values.clear();
|
values.clear();
|
||||||
settingValue[0] = '\0';
|
settingValue[0] = '\0';
|
||||||
settingKey = "";
|
settingKey.clear();
|
||||||
firstHatchLoop = true;
|
firstHatchLoop = true;
|
||||||
//firstHatchEdge = true;
|
//firstHatchEdge = true;
|
||||||
hatchEdge = DL_HatchEdgeData();
|
hatchEdge = DL_HatchEdgeData();
|
||||||
|
@ -1617,11 +1599,8 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/)
|
||||||
{
|
{
|
||||||
maxVertices = toInt(groupValue);
|
maxVertices = toInt(groupValue);
|
||||||
if (maxVertices>0)
|
if (maxVertices>0)
|
||||||
{
|
|
||||||
if (vertices!=nullptr)
|
|
||||||
{
|
{
|
||||||
delete[] vertices;
|
delete[] vertices;
|
||||||
}
|
|
||||||
vertices = new double[4*maxVertices];
|
vertices = new double[4*maxVertices];
|
||||||
for (int i=0; i<maxVertices; ++i)
|
for (int i=0; i<maxVertices; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1673,11 +1652,8 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
|
||||||
{
|
{
|
||||||
maxKnots = toInt(groupValue);
|
maxKnots = toInt(groupValue);
|
||||||
if (maxKnots>0)
|
if (maxKnots>0)
|
||||||
{
|
|
||||||
if (knots!=nullptr)
|
|
||||||
{
|
{
|
||||||
delete[] knots;
|
delete[] knots;
|
||||||
}
|
|
||||||
knots = new double[maxKnots];
|
knots = new double[maxKnots];
|
||||||
for (int i=0; i<maxKnots; ++i)
|
for (int i=0; i<maxKnots; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1693,15 +1669,9 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
|
||||||
{
|
{
|
||||||
maxControlPoints = toInt(groupValue);
|
maxControlPoints = toInt(groupValue);
|
||||||
if (maxControlPoints>0)
|
if (maxControlPoints>0)
|
||||||
{
|
|
||||||
if (controlPoints!=nullptr)
|
|
||||||
{
|
{
|
||||||
delete[] controlPoints;
|
delete[] controlPoints;
|
||||||
}
|
|
||||||
if (weights!=nullptr)
|
|
||||||
{
|
|
||||||
delete[] weights;
|
delete[] weights;
|
||||||
}
|
|
||||||
controlPoints = new double[3*maxControlPoints];
|
controlPoints = new double[3*maxControlPoints];
|
||||||
weights = new double[maxControlPoints];
|
weights = new double[maxControlPoints];
|
||||||
for (int i=0; i<maxControlPoints; ++i)
|
for (int i=0; i<maxControlPoints; ++i)
|
||||||
|
@ -1722,11 +1692,8 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
|
||||||
{
|
{
|
||||||
maxFitPoints = toInt(groupValue);
|
maxFitPoints = toInt(groupValue);
|
||||||
if (maxFitPoints>0)
|
if (maxFitPoints>0)
|
||||||
{
|
|
||||||
if (fitPoints!=nullptr)
|
|
||||||
{
|
{
|
||||||
delete[] fitPoints;
|
delete[] fitPoints;
|
||||||
}
|
|
||||||
fitPoints = new double[3*maxFitPoints];
|
fitPoints = new double[3*maxFitPoints];
|
||||||
for (int i=0; i<maxFitPoints; ++i)
|
for (int i=0; i<maxFitPoints; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1812,11 +1779,8 @@ bool DL_Dxf::handleLeaderData(DL_CreationInterface* /*creationInterface*/)
|
||||||
{
|
{
|
||||||
maxLeaderVertices = toInt(groupValue);
|
maxLeaderVertices = toInt(groupValue);
|
||||||
if (maxLeaderVertices>0)
|
if (maxLeaderVertices>0)
|
||||||
{
|
|
||||||
if (leaderVertices!=nullptr)
|
|
||||||
{
|
{
|
||||||
delete[] leaderVertices;
|
delete[] leaderVertices;
|
||||||
}
|
|
||||||
leaderVertices = new double[3*maxLeaderVertices];
|
leaderVertices = new double[3*maxLeaderVertices];
|
||||||
for (int i=0; i<maxLeaderVertices; ++i)
|
for (int i=0; i<maxLeaderVertices; ++i)
|
||||||
{
|
{
|
||||||
|
@ -4049,7 +4013,7 @@ int DL_Dxf::writeImage(DL_WriterA& dw,
|
||||||
|
|
||||||
// handle of IMAGEDEF object
|
// handle of IMAGEDEF object
|
||||||
int handle = static_cast<int>(dw.incHandle());
|
int handle = static_cast<int>(dw.incHandle());
|
||||||
dw.dxfHex(340, handle);
|
dw.dxfHex(340, handle); //-V525
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
dw.dxfInt(70, 15);
|
dw.dxfInt(70, 15);
|
||||||
|
@ -4087,7 +4051,7 @@ void DL_Dxf::writeImageDef(DL_WriterA& dw,
|
||||||
dw.dxfHex(5, handle);
|
dw.dxfHex(5, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbRasterImageDef");
|
dw.dxfString(100, "AcDbRasterImageDef");
|
||||||
dw.dxfInt(90, 0);
|
dw.dxfInt(90, 0);
|
||||||
|
@ -4381,7 +4345,7 @@ void DL_Dxf::writeVPort(DL_WriterA& dw) const
|
||||||
dw.dxfHex(5, 0x8);
|
dw.dxfHex(5, 0x8);
|
||||||
}
|
}
|
||||||
//dw.dxfHex(330, 0);
|
//dw.dxfHex(330, 0);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTable");
|
dw.dxfString(100, "AcDbSymbolTable");
|
||||||
}
|
}
|
||||||
|
@ -4393,7 +4357,7 @@ void DL_Dxf::writeVPort(DL_WriterA& dw) const
|
||||||
dw.handle();
|
dw.handle();
|
||||||
}
|
}
|
||||||
//dw.dxfHex(330, 8);
|
//dw.dxfHex(330, 8);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbViewportTableRecord");
|
dw.dxfString(100, "AcDbViewportTableRecord");
|
||||||
|
@ -4484,7 +4448,7 @@ void DL_Dxf::writeStyle(DL_WriterA& dw, const DL_StyleData& style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//dw.dxfHex(330, 3);
|
//dw.dxfHex(330, 3);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbTextStyleTableRecord");
|
dw.dxfString(100, "AcDbTextStyleTableRecord");
|
||||||
|
@ -4538,7 +4502,7 @@ void DL_Dxf::writeView(DL_WriterA& dw) const
|
||||||
dw.dxfHex(5, 6);
|
dw.dxfHex(5, 6);
|
||||||
}
|
}
|
||||||
//dw.dxfHex(330, 0);
|
//dw.dxfHex(330, 0);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTable");
|
dw.dxfString(100, "AcDbSymbolTable");
|
||||||
}
|
}
|
||||||
|
@ -4562,7 +4526,7 @@ void DL_Dxf::writeUcs(DL_WriterA& dw) const
|
||||||
dw.dxfHex(5, 7);
|
dw.dxfHex(5, 7);
|
||||||
}
|
}
|
||||||
//dw.dxfHex(330, 0);
|
//dw.dxfHex(330, 0);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTable");
|
dw.dxfString(100, "AcDbSymbolTable");
|
||||||
}
|
}
|
||||||
|
@ -4604,7 +4568,7 @@ void DL_Dxf::writeDimStyle(DL_WriterA& dw,
|
||||||
}
|
}
|
||||||
//dw.handle(105);
|
//dw.handle(105);
|
||||||
//dw.dxfHex(330, 0xA);
|
//dw.dxfHex(330, 0xA);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbDimStyleTableRecord");
|
dw.dxfString(100, "AcDbDimStyleTableRecord");
|
||||||
|
@ -4706,7 +4670,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
|
||||||
dw.dxfHex(5, 1);
|
dw.dxfHex(5, 1);
|
||||||
}
|
}
|
||||||
//dw.dxfHex(330, 0);
|
//dw.dxfHex(330, 0);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTable");
|
dw.dxfString(100, "AcDbSymbolTable");
|
||||||
}
|
}
|
||||||
|
@ -4720,7 +4684,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
|
||||||
//int msh = dw.handle();
|
//int msh = dw.handle();
|
||||||
//dw.setModelSpaceHandle(msh);
|
//dw.setModelSpaceHandle(msh);
|
||||||
//dw.dxfHex(330, 1);
|
//dw.dxfHex(330, 1);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbBlockTableRecord");
|
dw.dxfString(100, "AcDbBlockTableRecord");
|
||||||
|
@ -4736,7 +4700,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
|
||||||
//int psh = dw.handle();
|
//int psh = dw.handle();
|
||||||
//dw.setPaperSpaceHandle(psh);
|
//dw.setPaperSpaceHandle(psh);
|
||||||
//dw.dxfHex(330, 1);
|
//dw.dxfHex(330, 1);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbBlockTableRecord");
|
dw.dxfString(100, "AcDbBlockTableRecord");
|
||||||
|
@ -4752,7 +4716,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
|
||||||
//int ps0h = dw.handle();
|
//int ps0h = dw.handle();
|
||||||
//dw.setPaperSpace0Handle(ps0h);
|
//dw.setPaperSpace0Handle(ps0h);
|
||||||
//dw.dxfHex(330, 1);
|
//dw.dxfHex(330, 1);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbBlockTableRecord");
|
dw.dxfString(100, "AcDbBlockTableRecord");
|
||||||
|
@ -4776,7 +4740,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) const
|
||||||
dw.handle();
|
dw.handle();
|
||||||
}
|
}
|
||||||
//dw->dxfHex(330, 1);
|
//dw->dxfHex(330, 1);
|
||||||
if (version==DL_VERSION_2000)
|
if (version==DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dw.dxfString(100, "AcDbSymbolTableRecord");
|
dw.dxfString(100, "AcDbSymbolTableRecord");
|
||||||
dw.dxfString(100, "AcDbBlockTableRecord");
|
dw.dxfString(100, "AcDbBlockTableRecord");
|
||||||
|
@ -5235,10 +5199,6 @@ bool DL_Dxf::checkVariable(const char* var, DL_Codes::version version)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!strcmp(var, "$ACADVER"))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!strcmp(var, "$ANGBASE"))
|
if (!strcmp(var, "$ANGBASE"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -347,7 +347,7 @@ void DL_Writer::entityAttributes(const DL_Attributes &attrib) const
|
||||||
{
|
{
|
||||||
dxfInt(370, attrib.getWidth());
|
dxfInt(370, attrib.getWidth());
|
||||||
}
|
}
|
||||||
if (version>=DL_VERSION_2000)
|
if (version>=DL_VERSION_2000) //-V581
|
||||||
{
|
{
|
||||||
dxfReal(48, attrib.getLinetypeScale());
|
dxfReal(48, attrib.getLinetypeScale());
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void DL_WriterA::dxfReal(int gc, double value) const
|
||||||
// Cut away those zeros at the end:
|
// Cut away those zeros at the end:
|
||||||
bool dot = false;
|
bool dot = false;
|
||||||
int end = -1;
|
int end = -1;
|
||||||
for (quint32 i=0; i<strlen(str); ++i)
|
for (quint32 i=0, sz = strlen(str); i<sz; ++i)
|
||||||
{
|
{
|
||||||
if (str[i]=='.')
|
if (str[i]=='.')
|
||||||
{
|
{
|
||||||
|
|
|
@ -296,7 +296,8 @@ void VDxfEngine::drawTextItem(const QPointF & p, const QTextItem & textItem)
|
||||||
QPointF startPoint = matrix.map(p);
|
QPointF startPoint = matrix.map(p);
|
||||||
double rotationAngle = atan(matrix.m12()/matrix.m11());
|
double rotationAngle = atan(matrix.m12()/matrix.m11());
|
||||||
|
|
||||||
int textSize = textItem.font().pixelSize() == -1 ? textItem.font().pointSize() : textItem.font().pixelSize();
|
const QFont f = textItem.font();
|
||||||
|
int textSize = f.pixelSize() == -1 ? f.pointSize() : f.pixelSize();
|
||||||
dxf->writeText(
|
dxf->writeText(
|
||||||
*dw,
|
*dw,
|
||||||
DL_TextData(startPoint.x(),
|
DL_TextData(startPoint.x(),
|
||||||
|
@ -311,7 +312,7 @@ void VDxfEngine::drawTextItem(const QPointF & p, const QTextItem & textItem)
|
||||||
0, // Horizontal justification (0 = Left (default), 1 = Center, 2 = Right,)
|
0, // Horizontal justification (0 = Left (default), 1 = Center, 2 = Right,)
|
||||||
0, // Vertical justification (0 = Baseline (default), 1 = Bottom, 2 = Middle, 3= Top)
|
0, // Vertical justification (0 = Baseline (default), 1 = Bottom, 2 = Middle, 3= Top)
|
||||||
textItem.text().toUtf8().constData(), // text data
|
textItem.text().toUtf8().constData(), // text data
|
||||||
textItem.font().family().toUtf8().constData(), // font
|
f.family().toUtf8().constData(), // font
|
||||||
-rotationAngle
|
-rotationAngle
|
||||||
),
|
),
|
||||||
DL_Attributes("0", getPenColor(), state->pen().width(), getPenStyle(), 1.0));
|
DL_Attributes("0", getPenColor(), state->pen().width(), getPenStyle(), 1.0));
|
||||||
|
@ -341,7 +342,7 @@ QSize VDxfEngine::getSize() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDxfEngine::setSize(const QSize &value)
|
void VDxfEngine::setSize(const QSize &value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
size = value;
|
size = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +355,7 @@ int VDxfEngine::getResolution() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDxfEngine::setResolution(int value)
|
void VDxfEngine::setResolution(int value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
resolution = value;
|
resolution = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +368,7 @@ QString VDxfEngine::getFileName() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDxfEngine::setFileName(const QString &value)
|
void VDxfEngine::setFileName(const QString &value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
fileName = value;
|
fileName = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,13 +472,13 @@ int VDxfEngine::getPenColor()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDxfEngine::setMeasurement(const VarMeasurement &var)
|
void VDxfEngine::setMeasurement(const VarMeasurement &var)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
varMeasurement = var;
|
varMeasurement = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDxfEngine::setInsunits(const VarInsunits &var)
|
void VDxfEngine::setInsunits(const VarInsunits &var)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
varInsunits = var;
|
varInsunits = var;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ QVector<QPointF> VArc::GetPoints() const
|
||||||
qreal i = 0;
|
qreal i = 0;
|
||||||
const qreal angle = AngleArc();
|
const qreal angle = AngleArc();
|
||||||
const qint32 k = static_cast<qint32>(angle);
|
const qint32 k = static_cast<qint32>(angle);
|
||||||
const qreal s = angle/(k/4);
|
const qreal s = angle/(k/4); //-V636
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
QPointF pStart;
|
QPointF pStart;
|
||||||
|
|
|
@ -472,7 +472,7 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
|
||||||
{
|
{
|
||||||
const int dx1 = p2.toPoint().x() - p1.toPoint().x();
|
const int dx1 = p2.toPoint().x() - p1.toPoint().x();
|
||||||
const int dy1 = p2.toPoint().y() - p1.toPoint().y();
|
const int dy1 = p2.toPoint().y() - p1.toPoint().y();
|
||||||
const double epsilon = 0.003 * (dx1 * dx1 + dy1 * dy1);
|
const double epsilon = 0.003 * (dx1 * dx1 + dy1 * dy1); //-V636
|
||||||
return epsilon;
|
return epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
qreal L = 0, radius = 0, angle = 90;
|
qreal L = 0, radius = 0, angle = 90;
|
||||||
QPointF point1 = this->p1.toQPointF();
|
QPointF point1 = this->p1.toQPointF();
|
||||||
QPointF point4 = this->p4.toQPointF();
|
QPointF point4 = this->p4.toQPointF();
|
||||||
radius = QLineF(point1, point4).length()/1.414213;//1.414213=sqrt(2);
|
radius = QLineF(point1, point4).length()/M_SQRT2;
|
||||||
L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );
|
L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );
|
||||||
QLineF p1p2(this->p1.x(), this->p1.y(), this->p1.x() + L * kAsm1, this->p1.y());
|
QLineF p1p2(this->p1.x(), this->p1.y(), this->p1.x() + L * kAsm1, this->p1.y());
|
||||||
p1p2.setAngle(angle1);
|
p1p2.setAngle(angle1);
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
qreal L = 0, radius = 0, angle = 90;
|
qreal L = 0, radius = 0, angle = 90;
|
||||||
QPointF point1 = this->p1.toQPointF();
|
QPointF point1 = this->p1.toQPointF();
|
||||||
QPointF point4 = this->p4.toQPointF();
|
QPointF point4 = this->p4.toQPointF();
|
||||||
radius = QLineF(point1, point4).length()/1.414213;//1.414213=sqrt(2);
|
radius = QLineF(point1, point4).length()/M_SQRT2;
|
||||||
L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );
|
L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );
|
||||||
|
|
||||||
this->kCurve = kCurve;
|
this->kCurve = kCurve;
|
||||||
|
|
|
@ -53,7 +53,7 @@ VSplinePath::~VSplinePath()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VSplinePath::append(const VSplinePoint &point)
|
void VSplinePath::append(const VSplinePoint &point)
|
||||||
{
|
{
|
||||||
if (d->path.size() > 0 && d->path.last().P().toQPointF() == point.P().toQPointF())
|
if (d->path.size() > 0 && d->path.last().P().toQPointF() == point.P().toQPointF()) //-V807
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,8 +92,9 @@ VSpline VSplinePath::GetSpline(qint32 index) const
|
||||||
{
|
{
|
||||||
throw VException(tr("This spline does not exist."));
|
throw VException(tr("This spline does not exist."));
|
||||||
}
|
}
|
||||||
VSpline spl(d->path.at(index-1).P(), d->path.at(index).P(), d->path.at(index-1).Angle2(),
|
const VSplinePoint &p1 = d->path.at(index-1);
|
||||||
d->path.at(index).Angle1(), d->path.at(index-1).KAsm2(), d->path.at(index).KAsm1(), d->kCurve);
|
const VSplinePoint &p2 = d->path.at(index);
|
||||||
|
VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve);
|
||||||
return spl;
|
return spl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,8 +104,9 @@ QPainterPath VSplinePath::GetPath(PathDirection direction) const
|
||||||
QPainterPath painterPath;
|
QPainterPath painterPath;
|
||||||
for (qint32 i = 1; i <= Count(); ++i)
|
for (qint32 i = 1; i <= Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spl(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(),
|
const VSplinePoint &p1 = d->path.at(i-1);
|
||||||
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
|
const VSplinePoint &p2 = d->path.at(i);
|
||||||
|
VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve);
|
||||||
painterPath.addPath(spl.GetPath(direction));
|
painterPath.addPath(spl.GetPath(direction));
|
||||||
}
|
}
|
||||||
return painterPath;
|
return painterPath;
|
||||||
|
@ -116,8 +118,9 @@ QVector<QPointF> VSplinePath::GetPoints() const
|
||||||
QVector<QPointF> pathPoints;
|
QVector<QPointF> pathPoints;
|
||||||
for (qint32 i = 1; i <= Count(); ++i)
|
for (qint32 i = 1; i <= Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spl(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(),
|
const VSplinePoint &p1 = d->path.at(i-1);
|
||||||
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
|
const VSplinePoint &p2 = d->path.at(i);
|
||||||
|
VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve);
|
||||||
pathPoints += spl.GetPoints();
|
pathPoints += spl.GetPoints();
|
||||||
}
|
}
|
||||||
return pathPoints;
|
return pathPoints;
|
||||||
|
@ -129,8 +132,10 @@ qreal VSplinePath::GetLength() const
|
||||||
qreal length = 0;
|
qreal length = 0;
|
||||||
for (qint32 i = 1; i <= Count(); ++i)
|
for (qint32 i = 1; i <= Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spl(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(),
|
const VSplinePoint &p1 = d->path.at(i-1);
|
||||||
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
|
const VSplinePoint &p2 = d->path.at(i);
|
||||||
|
VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(),
|
||||||
|
p1.KAsm2(), p2.KAsm1(), d->kCurve);
|
||||||
length += spl.GetLength();
|
length += spl.GetLength();
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
|
@ -217,8 +222,10 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
|
||||||
fullLength = 0;
|
fullLength = 0;
|
||||||
for (qint32 i = 1; i <= Count(); ++i)
|
for (qint32 i = 1; i <= Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spl = VSpline(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(),
|
const VSplinePoint &point1 = d->path.at(i-1);
|
||||||
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
|
const VSplinePoint &point2 = d->path.at(i);
|
||||||
|
VSpline spl = VSpline(point1.P(), point2.P(), point1.Angle2(), point2.Angle1(), point1.KAsm2(),
|
||||||
|
point2.KAsm1(), d->kCurve);
|
||||||
fullLength += spl.GetLength();
|
fullLength += spl.GetLength();
|
||||||
if (fullLength > length)
|
if (fullLength > length)
|
||||||
{
|
{
|
||||||
|
@ -236,8 +243,9 @@ int VSplinePath::Segment(const QPointF &p) const
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (qint32 i = 1; i <= Count(); ++i)
|
for (qint32 i = 1; i <= Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spl = VSpline(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(),
|
const VSplinePoint &p1 = d->path.at(i-1);
|
||||||
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
|
const VSplinePoint &p2 = d->path.at(i);
|
||||||
|
VSpline spl = VSpline(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve);
|
||||||
|
|
||||||
const qreal t = spl.ParamT(p);
|
const qreal t = spl.ParamT(p);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ QSizeF VContour::GetSize() const
|
||||||
QVector<QPointF> VContour::UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const
|
QVector<QPointF> VContour::UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const
|
||||||
{
|
{
|
||||||
QVector<QPointF> newContour;
|
QVector<QPointF> newContour;
|
||||||
if (d->globalContour.isEmpty())
|
if (d->globalContour.isEmpty()) //-V807
|
||||||
{
|
{
|
||||||
AppendWhole(newContour, detail, detJ);
|
AppendWhole(newContour, detail, detJ);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ int VContour::EdgesCount() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLineF VContour::GlobalEdge(int i) const
|
QLineF VContour::GlobalEdge(int i) const
|
||||||
{
|
{
|
||||||
if (d->globalContour.isEmpty())
|
if (d->globalContour.isEmpty()) //-V807
|
||||||
{
|
{
|
||||||
// Because sheet is blank we have one global edge for all cases - Ox axis.
|
// Because sheet is blank we have one global edge for all cases - Ox axis.
|
||||||
const QLineF axis = EmptySheetEdge();
|
const QLineF axis = EmptySheetEdge();
|
||||||
|
|
|
@ -164,22 +164,23 @@ void VLayoutDetail::Mirror(const QLineF &edge)
|
||||||
const QLineF axis = QLineF(edge.x2(), edge.y2(), edge.x2() + 100, edge.y2()); // Ox axis
|
const QLineF axis = QLineF(edge.x2(), edge.y2(), edge.x2() + 100, edge.y2()); // Ox axis
|
||||||
|
|
||||||
const qreal angle = edge.angleTo(axis);
|
const qreal angle = edge.angleTo(axis);
|
||||||
|
const QPointF p2 = edge.p2();
|
||||||
QTransform m;
|
QTransform m;
|
||||||
m.translate(edge.p2().x(), edge.p2().y());
|
m.translate(p2.x(), p2.y());
|
||||||
m.rotate(-angle);
|
m.rotate(-angle);
|
||||||
m.translate(-edge.p2().x(), -edge.p2().y());
|
m.translate(-p2.x(), -p2.y());
|
||||||
d->matrix *= m;
|
d->matrix *= m;
|
||||||
|
|
||||||
m.reset();
|
m.reset();
|
||||||
m.translate(edge.p2().x(), edge.p2().y());
|
m.translate(p2.x(), p2.y());
|
||||||
m.scale(m.m11(), m.m22()*-1);
|
m.scale(m.m11(), m.m22()*-1);
|
||||||
m.translate(-edge.p2().x(), -edge.p2().y());
|
m.translate(-p2.x(), -p2.y());
|
||||||
d->matrix *= m;
|
d->matrix *= m;
|
||||||
|
|
||||||
m.reset();
|
m.reset();
|
||||||
m.translate(edge.p2().x(), edge.p2().y());
|
m.translate(p2.x(), p2.y());
|
||||||
m.rotate(-(360-angle));
|
m.rotate(-(360-angle));
|
||||||
m.translate(-edge.p2().x(), -edge.p2().y());
|
m.translate(-p2.x(), -p2.y());
|
||||||
d->matrix *= m;
|
d->matrix *= m;
|
||||||
|
|
||||||
d->mirror = !d->mirror;
|
d->mirror = !d->mirror;
|
||||||
|
@ -214,8 +215,9 @@ QLineF VLayoutDetail::Edge(int i) const
|
||||||
if (d->mirror)
|
if (d->mirror)
|
||||||
{
|
{
|
||||||
const int oldI1 = i1;
|
const int oldI1 = i1;
|
||||||
i1 = (d->layoutAllowence.size()-1) - i2;
|
const int size = d->layoutAllowence.size()-1; //-V807
|
||||||
i2 = (d->layoutAllowence.size()-1) - oldI1;
|
i1 = size - i2;
|
||||||
|
i2 = size - oldI1;
|
||||||
return QLineF(d->matrix.map(d->layoutAllowence.at(i2)), d->matrix.map(d->layoutAllowence.at(i1)));
|
return QLineF(d->matrix.map(d->layoutAllowence.at(i2)), d->matrix.map(d->layoutAllowence.at(i1)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -280,7 +282,7 @@ bool VLayoutDetail::isNull() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qint64 VLayoutDetail::Square() const
|
qint64 VLayoutDetail::Square() const
|
||||||
{
|
{
|
||||||
if (d->layoutAllowence.isEmpty())
|
if (d->layoutAllowence.isEmpty()) //-V807
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop) const
|
||||||
}
|
}
|
||||||
const int height = scene->itemsBoundingRect().toRect().height() + static_cast<int>(d->layoutWidth)*2;
|
const int height = scene->itemsBoundingRect().toRect().height() + static_cast<int>(d->layoutWidth)*2;
|
||||||
delete scene;
|
delete scene;
|
||||||
if (d->globalContour.GetHeight() > height)
|
if (d->globalContour.GetHeight() > height) //-V807
|
||||||
{
|
{
|
||||||
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height));
|
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height));
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,8 +497,8 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
|
||||||
|
|
||||||
for (int i=0; i<polyCorners; i++)
|
for (int i=0; i<polyCorners; i++)
|
||||||
{
|
{
|
||||||
const qreal xi = gContour.at(i).x();
|
const qreal xi = gContour.at(i).x(); //-V807
|
||||||
const qreal xj = gContour.at(j).x();
|
const qreal xj = gContour.at(j).x(); //-V807
|
||||||
const qreal yi = gContour.at(i).y();
|
const qreal yi = gContour.at(i).y();
|
||||||
const qreal yj = gContour.at(j).y();
|
const qreal yj = gContour.at(j).y();
|
||||||
if (qFuzzyCompare(yj, yi))
|
if (qFuzzyCompare(yj, yi))
|
||||||
|
@ -539,9 +539,10 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
|
||||||
const qreal yi = gContour.at(i).y();
|
const qreal yi = gContour.at(i).y();
|
||||||
const qreal yj = gContour.at(j).y();
|
const qreal yj = gContour.at(j).y();
|
||||||
|
|
||||||
if (((yi < p.at(n).y() && yj >= p.at(n).y()) || (yj < p.at(n).y() && yi >= p.at(n).y())))
|
const QPointF &pn = p.at(n);
|
||||||
|
if (((yi < pn.y() && yj >= pn.y()) || (yj < pn.y() && yi >= pn.y())))
|
||||||
{
|
{
|
||||||
oddNodes ^= (p.at(n).y() * multiple.at(i) + constant.at(i) < p.at(n).x());
|
oddNodes ^= (pn.y() * multiple.at(i) + constant.at(i) < pn.x());
|
||||||
}
|
}
|
||||||
|
|
||||||
j=i;
|
j=i;
|
||||||
|
|
|
@ -109,7 +109,7 @@ int VPoster::CountRows(int height) const
|
||||||
// Calculate how many pages will be after using allowence.
|
// Calculate how many pages will be after using allowence.
|
||||||
// We know start pages count. This number not enought because
|
// We know start pages count. This number not enought because
|
||||||
// each n-1 pages add (n-1)*allowence length to page (1).
|
// each n-1 pages add (n-1)*allowence length to page (1).
|
||||||
const qreal addionalLength = (pCount-1)*static_cast<int>(allowence);
|
const qreal addionalLength = (pCount-1)*static_cast<int>(allowence); //-V636
|
||||||
|
|
||||||
// Calculate additional length form pages that will cover this length (2).
|
// Calculate additional length form pages that will cover this length (2).
|
||||||
// In the end add page length (3).
|
// In the end add page length (3).
|
||||||
|
@ -139,7 +139,7 @@ int VPoster::CountColomns(int width) const
|
||||||
// Calculate how many pages will be after using allowence.
|
// Calculate how many pages will be after using allowence.
|
||||||
// We know start pages count. This number not enought because
|
// We know start pages count. This number not enought because
|
||||||
// each n-1 pages add (n-1)*allowence length to page (1).
|
// each n-1 pages add (n-1)*allowence length to page (1).
|
||||||
const qreal addionalLength = (pCount-1)*static_cast<int>(allowence);
|
const qreal addionalLength = (pCount-1)*static_cast<int>(allowence); //-V636
|
||||||
|
|
||||||
// Calculate additional length form pages that will cover this length (2).
|
// Calculate additional length form pages that will cover this length (2).
|
||||||
// In the end add page length (3).
|
// In the end add page length (3).
|
||||||
|
@ -190,35 +190,36 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
|
||||||
pen.setColor(Qt::black);
|
pen.setColor(Qt::black);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
|
|
||||||
|
const QRect rec = image.rect();
|
||||||
if (j != 0 && PageRect().x() > 0)
|
if (j != 0 && PageRect().x() > 0)
|
||||||
{// Left border
|
{// Left border
|
||||||
painter.drawLine(QLine(0, 0, 0, image.rect().height()));
|
painter.drawLine(QLine(0, 0, 0, rec.height()));
|
||||||
painter.drawImage(QPoint(0, image.rect().height()-static_cast<int>(allowence)),
|
painter.drawImage(QPoint(0, rec.height()-static_cast<int>(allowence)),
|
||||||
QImage("://scissors_vertical.png"));
|
QImage("://scissors_vertical.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j != colomns-1)
|
if (j != colomns-1)
|
||||||
{// Right border
|
{// Right border
|
||||||
painter.drawLine(QLine(image.rect().width()-static_cast<int>(allowence), 0,
|
painter.drawLine(QLine(rec.width()-static_cast<int>(allowence), 0,
|
||||||
image.rect().width()-static_cast<int>(allowence), image.rect().height()));
|
rec.width()-static_cast<int>(allowence), rec.height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != 0 && PageRect().y() > 0)
|
if (i != 0 && PageRect().y() > 0)
|
||||||
{// Top border
|
{// Top border
|
||||||
painter.drawLine(QLine(0, 0, image.rect().width(), 0));
|
painter.drawLine(QLine(0, 0, rec.width(), 0));
|
||||||
painter.drawImage(QPoint(image.rect().width()-static_cast<int>(allowence), 0),
|
painter.drawImage(QPoint(rec.width()-static_cast<int>(allowence), 0),
|
||||||
QImage("://scissors_horizontal.png"));
|
QImage("://scissors_horizontal.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows*colomns > 1)
|
if (rows*colomns > 1)
|
||||||
{ // Don't show bottom border if only one page need
|
{ // Don't show bottom border if only one page need
|
||||||
// Bottom border (mandatory)
|
// Bottom border (mandatory)
|
||||||
painter.drawLine(QLine(0, image.rect().height()-static_cast<int>(allowence),
|
painter.drawLine(QLine(0, rec.height()-static_cast<int>(allowence),
|
||||||
image.rect().width(), image.rect().height()-static_cast<int>(allowence)));
|
rec.width(), rec.height()-static_cast<int>(allowence)));
|
||||||
if (i == rows-1)
|
if (i == rows-1)
|
||||||
{
|
{
|
||||||
painter.drawImage(QPoint(image.rect().width()-static_cast<int>(allowence),
|
painter.drawImage(QPoint(rec.width()-static_cast<int>(allowence),
|
||||||
image.rect().height()-static_cast<int>(allowence)),
|
rec.height()-static_cast<int>(allowence)),
|
||||||
QImage("://scissors_horizontal.png"));
|
QImage("://scissors_horizontal.png"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,8 +227,8 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
|
||||||
// Labels
|
// Labels
|
||||||
const int layoutX = 15;
|
const int layoutX = 15;
|
||||||
const int layoutY = 5;
|
const int layoutY = 5;
|
||||||
QRect labels(layoutX, image.rect().height()-static_cast<int>(allowence)+layoutY,
|
QRect labels(layoutX, rec.height()-static_cast<int>(allowence)+layoutY,
|
||||||
image.rect().width()-(static_cast<int>(allowence)+layoutX), static_cast<int>(allowence)-layoutY);
|
rec.width()-(static_cast<int>(allowence)+layoutX), static_cast<int>(allowence)-layoutY);
|
||||||
painter.drawText(labels, Qt::AlignLeft, tr("Grid ( %1 , %2 )").arg(i+1).arg(j+1));
|
painter.drawText(labels, Qt::AlignLeft, tr("Grid ( %1 , %2 )").arg(i+1).arg(j+1));
|
||||||
painter.drawText(labels, Qt::AlignHCenter, tr("Page %1 of %2").arg(i*(colomns)+j+1).arg(rows*colomns));
|
painter.drawText(labels, Qt::AlignHCenter, tr("Page %1 of %2").arg(i*(colomns)+j+1).arg(rows*colomns));
|
||||||
if (sheets > 1)
|
if (sheets > 1)
|
||||||
|
|
|
@ -59,9 +59,8 @@ QString compilerString()
|
||||||
{
|
{
|
||||||
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return QLatin1String("<unknown compiler>");
|
|
||||||
#endif
|
#endif
|
||||||
|
return QLatin1String("<unknown compiler>");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_CC_MSVC
|
||||||
|
#include <ciso646>
|
||||||
|
#endif /* Q_CC_MSVC */
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
|
static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
|
||||||
{
|
{
|
||||||
|
@ -278,7 +282,7 @@ QSize VObjEngine::getSize() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VObjEngine::setSize(const QSize &value)
|
void VObjEngine::setSize(const QSize &value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
size = value;
|
size = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +295,7 @@ QIODevice *VObjEngine::getOutputDevice() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VObjEngine::setOutputDevice(QIODevice *value)
|
void VObjEngine::setOutputDevice(QIODevice *value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
outputDevice.reset(value);
|
outputDevice.reset(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +308,7 @@ int VObjEngine::getResolution() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VObjEngine::setResolution(int value)
|
void VObjEngine::setResolution(int value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isActive());
|
Q_ASSERT(not isActive());
|
||||||
resolution = value;
|
resolution = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
VObjPaintDevice::VObjPaintDevice()
|
VObjPaintDevice::VObjPaintDevice()
|
||||||
:QPaintDevice(), engine(new VObjEngine()), fileName(), owns_iodevice(1)
|
:QPaintDevice(), engine(new VObjEngine()), fileName(), owns_iodevice(1)
|
||||||
{
|
{
|
||||||
owns_iodevice = false;
|
owns_iodevice = static_cast<int>(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -75,7 +75,7 @@ void VObjPaintDevice::setFileName(const QString &value)
|
||||||
delete engine->getOutputDevice();
|
delete engine->getOutputDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
owns_iodevice = true;
|
owns_iodevice = static_cast<int>(true);
|
||||||
|
|
||||||
fileName = value;
|
fileName = value;
|
||||||
QFile *file = new QFile(fileName);
|
QFile *file = new QFile(fileName);
|
||||||
|
@ -113,7 +113,7 @@ void VObjPaintDevice::setOutputDevice(QIODevice *outputDevice)
|
||||||
qWarning("VObjPaintDevice::setOutputDevice(), cannot set output device while OBJ is being generated");
|
qWarning("VObjPaintDevice::setOutputDevice(), cannot set output device while OBJ is being generated");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
owns_iodevice = false;
|
owns_iodevice = static_cast<int>(false);
|
||||||
engine->setOutputDevice(outputDevice);
|
engine->setOutputDevice(outputDevice);
|
||||||
fileName = QString();
|
fileName = QString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ quint32 VContainer::AddGObject(VGObject *obj)
|
||||||
* @param detail new detail
|
* @param detail new detail
|
||||||
* @return return id of new detail in container
|
* @return return id of new detail in container
|
||||||
*/
|
*/
|
||||||
quint32 VContainer::AddDetail(VDetail detail)
|
quint32 VContainer::AddDetail(const VDetail &detail)
|
||||||
{
|
{
|
||||||
quint32 id = getNextId();
|
quint32 id = getNextId();
|
||||||
d->details[id] = detail;
|
d->details[id] = detail;
|
||||||
|
@ -224,7 +224,7 @@ void VContainer::UpdateId(quint32 newId)
|
||||||
template <typename val>
|
template <typename val>
|
||||||
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
|
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > NULL_ID, Q_FUNC_INFO, "id = 0");
|
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||||
SCASSERT(point.isNull() == false);
|
SCASSERT(point.isNull() == false);
|
||||||
point->setId(id);
|
point->setId(id);
|
||||||
if (d->gObjects.contains(id))
|
if (d->gObjects.contains(id))
|
||||||
|
@ -276,7 +276,7 @@ void VContainer::ClearForFullParse()
|
||||||
void VContainer::ClearGObjects()
|
void VContainer::ClearGObjects()
|
||||||
{
|
{
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
||||||
for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i)
|
for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i) //-V807
|
||||||
{
|
{
|
||||||
i.value().clear();
|
i.value().clear();
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void VContainer::ClearGObjects()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContainer::ClearCalculationGObjects()
|
void VContainer::ClearCalculationGObjects()
|
||||||
{
|
{
|
||||||
if (not d->gObjects.isEmpty())
|
if (not d->gObjects.isEmpty()) //-V807
|
||||||
{
|
{
|
||||||
QVector<quint32> keys;
|
QVector<quint32> keys;
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
||||||
|
@ -312,7 +312,7 @@ void VContainer::ClearCalculationGObjects()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContainer::ClearVariables(const VarType &type)
|
void VContainer::ClearVariables(const VarType &type)
|
||||||
{
|
{
|
||||||
if (d->variables.size()>0)
|
if (d->variables.size()>0) //-V807
|
||||||
{
|
{
|
||||||
if (type == VarType::Unknown)
|
if (type == VarType::Unknown)
|
||||||
{
|
{
|
||||||
|
@ -421,7 +421,7 @@ void VContainer::UpdateGObject(quint32 id, VGObject* obj)
|
||||||
*/
|
*/
|
||||||
void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
|
void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > NULL_ID, Q_FUNC_INFO, "id = 0");
|
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||||
d->details[id] = detail;
|
d->details[id] = detail;
|
||||||
UpdateId(id);
|
UpdateId(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#pragma GCC diagnostic ignored "-Weffc++"
|
#pragma GCC diagnostic ignored "-Weffc++"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class VContainerData : public QSharedData
|
class VContainerData : public QSharedData //-V690
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public:
|
||||||
static void UpdateId(quint32 newId);
|
static void UpdateId(quint32 newId);
|
||||||
|
|
||||||
quint32 AddGObject(VGObject *obj);
|
quint32 AddGObject(VGObject *obj);
|
||||||
quint32 AddDetail(VDetail detail);
|
quint32 AddDetail(const VDetail &detail);
|
||||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||||
void AddArc(const quint32 &arcId, const quint32 &parentId = 0);
|
void AddArc(const quint32 &arcId, const quint32 &parentId = 0);
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ VDetail VDetail::RemoveEdge(const quint32 &index) const
|
||||||
*/
|
*/
|
||||||
QList<quint32> VDetail::Missing(const VDetail &det) const
|
QList<quint32> VDetail::Missing(const VDetail &det) const
|
||||||
{
|
{
|
||||||
if (d->nodes.size() == det.CountNode())
|
if (d->nodes.size() == det.CountNode()) //-V807
|
||||||
{
|
{
|
||||||
return QList<quint32>();
|
return QList<quint32>();
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ QPainterPath VDetail::ContourPath(const VContainer *data) const
|
||||||
QVector<VNodeDetail> VDetail::listNodePoint() const
|
QVector<VNodeDetail> VDetail::listNodePoint() const
|
||||||
{
|
{
|
||||||
QVector<VNodeDetail> list;
|
QVector<VNodeDetail> list;
|
||||||
for (int i = 0; i < d->nodes.size(); ++i)
|
for (int i = 0; i < d->nodes.size(); ++i) //-V807
|
||||||
{
|
{
|
||||||
if (d->nodes.at(i).getTypeTool() == Tool::NodePoint)
|
if (d->nodes.at(i).getTypeTool() == Tool::NodePoint)
|
||||||
{
|
{
|
||||||
|
|
|
@ -498,11 +498,12 @@ bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const
|
||||||
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin();
|
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin();
|
||||||
while (i != variables.constEnd())
|
while (i != variables.constEnd())
|
||||||
{
|
{
|
||||||
if (token.indexOf( i.value().translate() ) == 0)
|
const QmuTranslation &var = i.value();
|
||||||
|
if (token.indexOf( var.translate() ) == 0)
|
||||||
{
|
{
|
||||||
newFormula.replace(position, i.value().translate().length(), i.key());
|
newFormula.replace(position, var.translate().length(), i.key());
|
||||||
QString newToken = token;
|
QString newToken = token;
|
||||||
newToken.replace(0, i.value().translate().length(), i.key());
|
newToken.replace(0, var.translate().length(), i.key());
|
||||||
bias = token.length() - newToken.length();
|
bias = token.length() - newToken.length();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
namespace VPE
|
namespace VPE
|
||||||
{
|
{
|
||||||
|
|
||||||
struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D
|
struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D //-V690
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Vector3D()
|
Vector3D()
|
||||||
|
|
|
@ -114,7 +114,7 @@ void VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int en
|
||||||
updatePropertyList();
|
updatePropertyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end)
|
void VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end) //-V524
|
||||||
{
|
{
|
||||||
// todo: Only rebuild the neccessary parts
|
// todo: Only rebuild the neccessary parts
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
|
@ -423,7 +423,7 @@ void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, co
|
||||||
* @param var container with variables
|
* @param var container with variables
|
||||||
*/
|
*/
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
void DialogEditWrongFormula::ShowVariable(const QMap<key, val> var)
|
void DialogEditWrongFormula::ShowVariable(const QMap<key, val> &var)
|
||||||
{
|
{
|
||||||
ui->listWidget->blockSignals(true);
|
ui->listWidget->blockSignals(true);
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
|
|
|
@ -97,7 +97,7 @@ private:
|
||||||
void InitVariables();
|
void InitVariables();
|
||||||
|
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
void ShowVariable(const QMap<key, val> var);
|
void ShowVariable(const QMap<key, val> &var);
|
||||||
|
|
||||||
void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description);
|
void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description);
|
||||||
};
|
};
|
||||||
|
|
|
@ -256,8 +256,9 @@ void DialogDetail::setDetail(const VDetail &value)
|
||||||
ui.listWidget->clear();
|
ui.listWidget->clear();
|
||||||
for (int i = 0; i < detail.CountNode(); ++i)
|
for (int i = 0; i < detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
NewItem(detail.at(i).getId(), detail.at(i).getTypeTool(), detail.at(i).getTypeNode(), detail.at(i).getMx(),
|
const VNodeDetail &node = detail.at(i);
|
||||||
detail.at(i).getMy(), detail.at(i).getReverse());
|
NewItem(node.getId(), node.getTypeTool(), node.getTypeNode(), node.getMx(),
|
||||||
|
node.getMy(), node.getReverse());
|
||||||
}
|
}
|
||||||
ui.lineEditNameDetail->setText(detail.getName());
|
ui.lineEditNameDetail->setText(detail.getName());
|
||||||
ui.checkBoxSeams->setChecked(detail.getSeamAllowance());
|
ui.checkBoxSeams->setChecked(detail.getSeamAllowance());
|
||||||
|
|
|
@ -111,7 +111,7 @@ CrossCirclesPoint DialogPointFromArcAndTangent::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &p)
|
void DialogPointFromArcAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &p)
|
||||||
{
|
{
|
||||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
void SetTangentPointId(const quint32 &value);
|
void SetTangentPointId(const quint32 &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &p);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -161,7 +161,7 @@ CrossCirclesPoint DialogPointFromCircleAndTangent::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &p)
|
void DialogPointFromCircleAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &p)
|
||||||
{
|
{
|
||||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
void SetTangentPointId(const quint32 &value);
|
void SetTangentPointId(const quint32 &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &p);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -114,7 +114,7 @@ CrossCirclesPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossCirclesPoint &p)
|
void DialogPointOfIntersectionArcs::SetCrossArcPoint(const CrossCirclesPoint &p)
|
||||||
{
|
{
|
||||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
void SetSecondArcId(const quint32 &value);
|
void SetSecondArcId(const quint32 &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossArcPoint() const;
|
CrossCirclesPoint GetCrossArcPoint() const;
|
||||||
void SetCrossArcPoint(CrossCirclesPoint &p);
|
void SetCrossArcPoint(const CrossCirclesPoint &p);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -202,7 +202,7 @@ CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(CrossCirclesPoint &p)
|
void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPoint &p)
|
||||||
{
|
{
|
||||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
void SetSecondCircleRadius(const QString &value);
|
void SetSecondCircleRadius(const QString &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &p);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -84,7 +84,8 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
||||||
{
|
{
|
||||||
NewItem(path.at(i).P().id(), path.at(i).KAsm1(), path.at(i).Angle1(), path.at(i).KAsm2(), path.at(i).Angle2());
|
const VSplinePoint &point = path.at(i);
|
||||||
|
NewItem(point.P().id(), point.KAsm1(), point.Angle1(), point.KAsm2(), point.Angle2());
|
||||||
}
|
}
|
||||||
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
||||||
ui->doubleSpinBoxKcurve->setValue(path.GetKCurve());
|
ui->doubleSpinBoxKcurve->setValue(path.GetKCurve());
|
||||||
|
|
|
@ -684,7 +684,7 @@ void DialogTool::FormulaChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTool::FormulaChangedPlainText()
|
void DialogTool::FormulaChangedPlainText() //-V524
|
||||||
{
|
{
|
||||||
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
|
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
|
||||||
if (edit)
|
if (edit)
|
||||||
|
|
|
@ -100,8 +100,8 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstr
|
||||||
QString f1 = dialogTool->GetF1();
|
QString f1 = dialogTool->GetF1();
|
||||||
QString f2 = dialogTool->GetF2();
|
QString f2 = dialogTool->GetF2();
|
||||||
const QString color = dialogTool->GetColor();
|
const QString color = dialogTool->GetColor();
|
||||||
VToolArc* point = nullptr;
|
VToolArc* point = Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse,
|
||||||
point=Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -344,12 +344,13 @@ void VToolArc::SetVisualization()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||||
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
|
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr);
|
||||||
|
|
||||||
|
const VTranslateVars *trVars = qApp->TrVars();
|
||||||
visual->setPoint1Id(arc->GetCenter().id());
|
visual->setPoint1Id(arc->GetCenter().id());
|
||||||
visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius()));
|
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
|
||||||
visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1()));
|
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
|
||||||
visual->setF2(qApp->TrVars()->FormulaToUser(arc->GetFormulaF2()));
|
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2()));
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ VToolArcWithLength *VToolArcWithLength::Create(DialogTool *dialog, VMainGraphics
|
||||||
QString f1 = dialogTool->GetF1();
|
QString f1 = dialogTool->GetF1();
|
||||||
QString length = dialogTool->GetLength();
|
QString length = dialogTool->GetLength();
|
||||||
const QString color = dialogTool->GetColor();
|
const QString color = dialogTool->GetColor();
|
||||||
VToolArcWithLength* point = nullptr;
|
VToolArcWithLength* point = Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse,
|
||||||
point=Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -300,12 +300,13 @@ void VToolArcWithLength::SetVisualization()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||||
VisToolArcWithLength *visual = qobject_cast<VisToolArcWithLength *>(vis);
|
VisToolArcWithLength *visual = qobject_cast<VisToolArcWithLength *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr);
|
||||||
|
|
||||||
|
const VTranslateVars *trVars = qApp->TrVars();
|
||||||
visual->setPoint1Id(arc->GetCenter().id());
|
visual->setPoint1Id(arc->GetCenter().id());
|
||||||
visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius()));
|
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
|
||||||
visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1()));
|
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
|
||||||
visual->setLength(qApp->TrVars()->FormulaToUser(arc->GetFormulaLength()));
|
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength()));
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,9 +139,8 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
const qreal angle2 = dialogTool->GetAngle2();
|
const qreal angle2 = dialogTool->GetAngle2();
|
||||||
const qreal kCurve = dialogTool->GetKCurve();
|
const qreal kCurve = dialogTool->GetKCurve();
|
||||||
const QString color = dialogTool->GetColor();
|
const QString color = dialogTool->GetColor();
|
||||||
VToolSpline *spl = nullptr;
|
VToolSpline *spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data,
|
||||||
spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data, Document::FullParse,
|
Document::FullParse, Source::FromGui);
|
||||||
Source::FromGui);
|
|
||||||
if (spl != nullptr)
|
if (spl != nullptr)
|
||||||
{
|
{
|
||||||
spl->dialog=dialogTool;
|
spl->dialog=dialogTool;
|
||||||
|
|
|
@ -132,8 +132,7 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
|
||||||
{
|
{
|
||||||
doc->IncrementReferens((*path)[i].P().id());
|
doc->IncrementReferens((*path)[i].P().id());
|
||||||
}
|
}
|
||||||
VToolSplinePath* spl = nullptr;
|
VToolSplinePath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
|
||||||
if (spl != nullptr)
|
if (spl != nullptr)
|
||||||
{
|
{
|
||||||
spl->dialog=dialogTool;
|
spl->dialog=dialogTool;
|
||||||
|
|
|
@ -120,9 +120,9 @@ VToolTrueDarts *VToolTrueDarts::Create(DialogTool *dialog, VMainGraphicsScene *s
|
||||||
const quint32 dartP2Id = dialogTool->GetSecondDartPointId();
|
const quint32 dartP2Id = dialogTool->GetSecondDartPointId();
|
||||||
const quint32 dartP3Id = dialogTool->GetThirdDartPointId();
|
const quint32 dartP3Id = dialogTool->GetThirdDartPointId();
|
||||||
|
|
||||||
VToolTrueDarts *point = nullptr;
|
VToolTrueDarts *point = Create(0, 0, 0, baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id,
|
||||||
point=Create(0, 0, 0, baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id, point1Name, 5, 10, point2Name, 5,
|
point1Name, 5, 10, point2Name, 5, 10, scene, doc, data, Document::FullParse,
|
||||||
10, scene, doc, data, Document::FullParse, Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog = dialogTool;
|
point->dialog = dialogTool;
|
||||||
|
|
|
@ -37,9 +37,9 @@ VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, c
|
||||||
:VToolSinglePoint(doc, data, id, parent), formula(formula), firstCurve(nullptr), secondCurve(nullptr),
|
:VToolSinglePoint(doc, data, id, parent), formula(formula), firstCurve(nullptr), secondCurve(nullptr),
|
||||||
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id), detailsMode(false)
|
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id), detailsMode(false)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(curveCutId > 0, Q_FUNC_INFO, "curveCutId <= 0");
|
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
|
||||||
Q_ASSERT_X(curve1id > 0, Q_FUNC_INFO, "curve1id <= 0");
|
Q_ASSERT_X(curve1id != 0, Q_FUNC_INFO, "curve1id == 0"); //-V654 //-V712
|
||||||
Q_ASSERT_X(curve2id > 0, Q_FUNC_INFO, "curve2id <= 0");
|
Q_ASSERT_X(curve2id != 0, Q_FUNC_INFO, "curve2id == 0"); //-V654 //-V712
|
||||||
|
|
||||||
lineColor = color;
|
lineColor = color;
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ void VToolCut::RemoveReferens()
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
|
void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(attrCurve.isEmpty() == false, Q_FUNC_INFO, "attribute name is empty");
|
Q_ASSERT_X(not attrCurve.isEmpty(), Q_FUNC_INFO, "attribute name is empty");
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(id);
|
QDomElement domElement = doc->elementById(id);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
|
|
|
@ -94,8 +94,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
QString formula = dialogTool->GetFormula();
|
QString formula = dialogTool->GetFormula();
|
||||||
const quint32 arcId = dialogTool->getArcId();
|
const quint32 arcId = dialogTool->getArcId();
|
||||||
const QString color = dialogTool->GetColor();
|
const QString color = dialogTool->GetColor();
|
||||||
VToolCutArc* point = nullptr;
|
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse,
|
||||||
point=Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -94,8 +94,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
|
||||||
QString formula = dialogTool->GetFormula();
|
QString formula = dialogTool->GetFormula();
|
||||||
const quint32 splineId = dialogTool->getSplineId();
|
const quint32 splineId = dialogTool->getSplineId();
|
||||||
const QString color = dialogTool->GetColor();
|
const QString color = dialogTool->GetColor();
|
||||||
VToolCutSpline* point = nullptr;
|
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
|
||||||
point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
|
|
||||||
Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,8 +97,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
|
||||||
QString formula = dialogTool->GetFormula();
|
QString formula = dialogTool->GetFormula();
|
||||||
const quint32 splinePathId = dialogTool->getSplinePathId();
|
const quint32 splinePathId = dialogTool->getSplinePathId();
|
||||||
const QString color = dialogTool->GetColor();
|
const QString color = dialogTool->GetColor();
|
||||||
VToolCutSplinePath* point = nullptr;
|
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
|
||||||
point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
|
|
||||||
Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,9 +205,8 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
|
||||||
const QString typeLine = dialogTool->GetTypeLine();
|
const QString typeLine = dialogTool->GetTypeLine();
|
||||||
const QString lineColor = dialogTool->GetLineColor();
|
const QString lineColor = dialogTool->GetLineColor();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolAlongLine *point=nullptr;
|
VToolAlongLine *point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId,
|
||||||
point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
|
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -137,9 +137,8 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
|
||||||
const QString typeLine = dialogTool->GetTypeLine();
|
const QString typeLine = dialogTool->GetTypeLine();
|
||||||
const QString lineColor = dialogTool->GetLineColor();
|
const QString lineColor = dialogTool->GetLineColor();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolBisector *point = nullptr;
|
VToolBisector *point = Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor,
|
||||||
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor, pointName, 5, 10, scene,
|
pointName, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
doc, data, Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -84,9 +84,9 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
|
||||||
const quint32 basePointId = dialogTool->GetBasePointId();
|
const quint32 basePointId = dialogTool->GetBasePointId();
|
||||||
const quint32 curveId = dialogTool->getCurveId();
|
const quint32 curveId = dialogTool->getCurveId();
|
||||||
|
|
||||||
VToolCurveIntersectAxis *point = nullptr;
|
VToolCurveIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId,
|
||||||
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data,
|
curveId, 5, 10, scene, doc, data, Document::FullParse,
|
||||||
Document::FullParse, Source::FromGui);
|
Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -104,9 +104,8 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
||||||
QString formulaAngle = dialogTool->GetAngle();
|
QString formulaAngle = dialogTool->GetAngle();
|
||||||
const quint32 basePointId = dialogTool->GetBasePointId();
|
const quint32 basePointId = dialogTool->GetBasePointId();
|
||||||
|
|
||||||
VToolEndLine *point = nullptr;
|
VToolEndLine *point = Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle,
|
||||||
point=Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
|
basePointId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -94,9 +94,8 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
const quint32 p1LineId = dialogTool->GetP1LineId();
|
const quint32 p1LineId = dialogTool->GetP1LineId();
|
||||||
const quint32 p2LineId = dialogTool->GetP2LineId();
|
const quint32 p2LineId = dialogTool->GetP2LineId();
|
||||||
|
|
||||||
VToolHeight *point = nullptr;
|
VToolHeight *point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc,
|
||||||
point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
|
data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -86,8 +86,8 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
|
||||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||||
|
|
||||||
VToolLineIntersectAxis *point = nullptr;
|
VToolLineIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle,
|
||||||
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10,
|
basePointId, firstPointId, secondPointId, 5, 10,
|
||||||
scene, doc, data, Document::FullParse, Source::FromGui);
|
scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
|
||||||
{
|
{
|
||||||
this->typeLine = typeLine;
|
this->typeLine = typeLine;
|
||||||
this->lineColor = lineColor;
|
this->lineColor = lineColor;
|
||||||
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
|
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
|
||||||
QPointF point1 = data->GeometricObject<VPointF>(basePointId)->toQPointF();
|
QPointF point1 = data->GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||||
QPointF point2 = data->GeometricObject<VPointF>(id)->toQPointF();
|
QPointF point2 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||||
|
|
|
@ -98,9 +98,8 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||||
const QString lineColor = dialogTool->GetLineColor();
|
const QString lineColor = dialogTool->GetLineColor();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
const qreal angle = dialogTool->GetAngle();
|
const qreal angle = dialogTool->GetAngle();
|
||||||
VToolNormal *point = nullptr;
|
VToolNormal *point = Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10,
|
||||||
point=Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10, scene, doc,
|
scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
data, Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -138,9 +138,8 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
|
||||||
const QString typeLine = dialogTool->GetTypeLine();
|
const QString typeLine = dialogTool->GetTypeLine();
|
||||||
const QString lineColor = dialogTool->GetLineColor();
|
const QString lineColor = dialogTool->GetLineColor();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolShoulderPoint * point = nullptr;
|
VToolShoulderPoint * point = Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5,
|
||||||
point=Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5, 10, scene, doc, data,
|
10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -92,7 +92,7 @@ void VToolBasePoint::ShowVisualization(bool show)
|
||||||
*/
|
*/
|
||||||
void VToolBasePoint::AddToFile()
|
void VToolBasePoint::AddToFile()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty");
|
Q_ASSERT_X(not namePP.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty");
|
||||||
|
|
||||||
QDomElement sPoint = doc->createElement(TagName);
|
QDomElement sPoint = doc->createElement(TagName);
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,8 @@ VToolLineIntersect* VToolLineIntersect::Create(DialogTool *dialog, VMainGraphics
|
||||||
const quint32 p1Line2Id = dialogTool->GetP1Line2();
|
const quint32 p1Line2Id = dialogTool->GetP1Line2();
|
||||||
const quint32 p2Line2Id = dialogTool->GetP2Line2();
|
const quint32 p2Line2Id = dialogTool->GetP2Line2();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolLineIntersect* point = nullptr;
|
VToolLineIntersect* point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc,
|
||||||
point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data,
|
data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -68,9 +68,8 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(DialogTool *dia
|
||||||
const quint32 tangentPointId = dialogTool->GetTangentPointId();
|
const quint32 tangentPointId = dialogTool->GetTangentPointId();
|
||||||
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolPointFromArcAndTangent *point = nullptr;
|
VToolPointFromArcAndTangent *point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc,
|
||||||
point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc, data, Document::FullParse,
|
data, Document::FullParse, Source::FromGui);
|
||||||
Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -244,7 +243,7 @@ CrossCirclesPoint VToolPointFromArcAndTangent::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value)
|
void VToolPointFromArcAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &value)
|
||||||
{
|
{
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
void SetArcId(const quint32 &value);
|
void SetArcId(const quint32 &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &value);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -73,9 +73,8 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(DialogToo
|
||||||
const quint32 tangentPointId = dialogTool->GetTangentPointId();
|
const quint32 tangentPointId = dialogTool->GetTangentPointId();
|
||||||
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolPointFromCircleAndTangent *point = nullptr;
|
VToolPointFromCircleAndTangent *point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType,
|
||||||
point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType, 5, 10, scene, doc, data,
|
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -228,7 +227,7 @@ CrossCirclesPoint VToolPointFromCircleAndTangent::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value)
|
void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &value)
|
||||||
{
|
{
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
void SetCircleRadius(const VFormula &value);
|
void SetCircleRadius(const VFormula &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &value);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -155,9 +155,8 @@ VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphi
|
||||||
const quint32 firstPointId = dialogTool->GetFirstPoint();
|
const quint32 firstPointId = dialogTool->GetFirstPoint();
|
||||||
const quint32 secondPointId = dialogTool->GetSecondPoint();
|
const quint32 secondPointId = dialogTool->GetSecondPoint();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolPointOfContact *point = nullptr;
|
VToolPointOfContact *point = Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc,
|
||||||
point=Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data,
|
data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -86,9 +86,8 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(DialogTool *dialog, V
|
||||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolPointOfIntersection *point = nullptr;
|
VToolPointOfIntersection *point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc,
|
||||||
point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse,
|
data, Document::FullParse, Source::FromGui);
|
||||||
Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -68,9 +68,8 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *d
|
||||||
const quint32 secondArcId = dialogTool->GetSecondArcId();
|
const quint32 secondArcId = dialogTool->GetSecondArcId();
|
||||||
const CrossCirclesPoint pType = dialogTool->GetCrossArcPoint();
|
const CrossCirclesPoint pType = dialogTool->GetCrossArcPoint();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolPointOfIntersectionArcs *point = nullptr;
|
VToolPointOfIntersectionArcs *point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc,
|
||||||
point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc, data, Document::FullParse,
|
data, Document::FullParse, Source::FromGui);
|
||||||
Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -126,19 +125,20 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32
|
||||||
QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossCirclesPoint pType)
|
QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossCirclesPoint pType)
|
||||||
{
|
{
|
||||||
QPointF p1, p2;
|
QPointF p1, p2;
|
||||||
const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(),
|
const QPointF centerArc1 = arc1->GetCenter().toQPointF();
|
||||||
arc2->GetCenter().toQPointF(), arc2->GetRadius(), p1, p2);
|
const QPointF centerArc2 = arc2->GetCenter().toQPointF();
|
||||||
|
const int res = VGObject::IntersectionCircles(centerArc1, arc1->GetRadius(), centerArc2, arc2->GetRadius(), p1, p2);
|
||||||
|
|
||||||
QLineF r1Arc1(arc1->GetCenter().toQPointF(), p1);
|
QLineF r1Arc1(centerArc1, p1);
|
||||||
r1Arc1.setLength(r1Arc1.length()+10);
|
r1Arc1.setLength(r1Arc1.length()+10);
|
||||||
|
|
||||||
QLineF r1Arc2(arc2->GetCenter().toQPointF(), p1);
|
QLineF r1Arc2(centerArc2, p1);
|
||||||
r1Arc2.setLength(r1Arc2.length()+10);
|
r1Arc2.setLength(r1Arc2.length()+10);
|
||||||
|
|
||||||
QLineF r2Arc1(arc1->GetCenter().toQPointF(), p2);
|
QLineF r2Arc1(centerArc1, p2);
|
||||||
r2Arc1.setLength(r2Arc1.length()+10);
|
r2Arc1.setLength(r2Arc1.length()+10);
|
||||||
|
|
||||||
QLineF r2Arc2(arc2->GetCenter().toQPointF(), p2);
|
QLineF r2Arc2(centerArc2, p2);
|
||||||
r2Arc2.setLength(r2Arc2.length()+10);
|
r2Arc2.setLength(r2Arc2.length()+10);
|
||||||
|
|
||||||
switch(res)
|
switch(res)
|
||||||
|
@ -250,7 +250,7 @@ CrossCirclesPoint VToolPointOfIntersectionArcs::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionArcs::SetCrossCirclesPoint(CrossCirclesPoint &value)
|
void VToolPointOfIntersectionArcs::SetCrossCirclesPoint(const CrossCirclesPoint &value)
|
||||||
{
|
{
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
void SetSecondArcId(const quint32 &value);
|
void SetSecondArcId(const quint32 &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &value);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -79,9 +79,9 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(DialogT
|
||||||
QString secondCircleRadius = dialogTool->GetSecondCircleRadius();
|
QString secondCircleRadius = dialogTool->GetSecondCircleRadius();
|
||||||
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolPointOfIntersectionCircles *point = nullptr;
|
VToolPointOfIntersectionCircles *point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId,
|
||||||
point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId, firstCircleRadius, secondCircleRadius,
|
firstCircleRadius, secondCircleRadius, pType, 5, 10, scene, doc,
|
||||||
pType, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
data, Document::FullParse, Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -263,7 +263,7 @@ CrossCirclesPoint VToolPointOfIntersectionCircles::GetCrossCirclesPoint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionCircles::SetCrossCirclesPoint(CrossCirclesPoint &value)
|
void VToolPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPoint &value)
|
||||||
{
|
{
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
void SetSecondCircleRadius(const VFormula &value);
|
void SetSecondCircleRadius(const VFormula &value);
|
||||||
|
|
||||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||||
void SetCrossCirclesPoint(CrossCirclesPoint &value);
|
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -93,9 +93,8 @@ VToolTriangle* VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *sce
|
||||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
VToolTriangle* point = nullptr;
|
VToolTriangle* point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10,
|
||||||
point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data,
|
scene, doc, data, Document::FullParse, Source::FromGui);
|
||||||
Document::FullParse, Source::FromGui);
|
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
|
|
@ -128,8 +128,7 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, b
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||||
QAction *actionRemove = nullptr;
|
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
|
||||||
if (showRemove)
|
if (showRemove)
|
||||||
{
|
{
|
||||||
if (_referens > 1)
|
if (_referens > 1)
|
||||||
|
|
|
@ -101,8 +101,7 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbs
|
||||||
const QString typeLine = dialogTool->GetTypeLine();
|
const QString typeLine = dialogTool->GetTypeLine();
|
||||||
const QString lineColor = dialogTool->GetLineColor();
|
const QString lineColor = dialogTool->GetLineColor();
|
||||||
|
|
||||||
VToolLine *line = nullptr;
|
VToolLine *line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse,
|
||||||
line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse,
|
|
||||||
Source::FromGui);
|
Source::FromGui);
|
||||||
if (line != nullptr)
|
if (line != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,23 +46,6 @@ VDataTool::VDataTool(VContainer *data, QObject *parent)
|
||||||
VDataTool::~VDataTool()
|
VDataTool::~VDataTool()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief operator = assignment operator.
|
|
||||||
* @param tool tool
|
|
||||||
* @return tool
|
|
||||||
*/
|
|
||||||
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
|
||||||
{
|
|
||||||
if ( &tool == this )
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
data = tool.getData();
|
|
||||||
_referens = tool.referens();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief decrementReferens decrement referens.
|
* @brief decrementReferens decrement referens.
|
||||||
|
|
|
@ -46,7 +46,6 @@ class VDataTool : public QObject
|
||||||
public:
|
public:
|
||||||
explicit VDataTool(VContainer *data, QObject *parent = nullptr);
|
explicit VDataTool(VContainer *data, QObject *parent = nullptr);
|
||||||
virtual ~VDataTool() Q_DECL_OVERRIDE;
|
virtual ~VDataTool() Q_DECL_OVERRIDE;
|
||||||
VDataTool &operator= (const VDataTool &tool);
|
|
||||||
VContainer getData() const;
|
VContainer getData() const;
|
||||||
void setData(const VContainer *value);
|
void setData(const VContainer *value);
|
||||||
virtual quint32 referens() const;
|
virtual quint32 referens() const;
|
||||||
|
@ -58,6 +57,8 @@ protected:
|
||||||
|
|
||||||
/** @brief _referens keep count tools what use this tool. If value more than 1 you can't delete tool. */
|
/** @brief _referens keep count tools what use this tool. If value more than 1 you can't delete tool. */
|
||||||
quint32 _referens;
|
quint32 _referens;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VDataTool)
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user