Static Code Analysis.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-28 16:22:36 +02:00
parent ff31ac889c
commit 88324a11f2
118 changed files with 682 additions and 744 deletions

View File

@ -76,16 +76,17 @@ TapeConfigurationPage::TapeConfigurationPage(QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigurationPage::Apply()
{
qApp->TapeSettings()->SetOsSeparator(osOptionCheck->isChecked());
VTapeSettings *settings = qApp->TapeSettings();
settings->SetOsSeparator(osOptionCheck->isChecked());
if (langChanged || systemChanged)
{
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
qApp->TapeSettings()->SetLocale(locale);
settings->SetLocale(locale);
langChanged = false;
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
qApp->TapeSettings()->SetPMSystemCode(code);
settings->SetPMSystemCode(code);
systemChanged = false;
qApp->LoadTranslation(locale);
@ -173,7 +174,8 @@ QGroupBox *TapeConfigurationPage::LangGroup()
}
// 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)
{
langCombo->setCurrentIndex(index);
@ -209,7 +211,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
&TapeConfigurationPage::SystemChanged);
// set default pattern making system
index = systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode());
index = systemCombo->findData(settings->GetPMSystemCode());
if (index != -1)
{
systemCombo->setCurrentIndex(index);
@ -219,7 +221,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
separatorLabel = new QLabel(tr("Decimal separator parts"));
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);
//-----------------------

View File

@ -65,9 +65,10 @@ TapePathPage::TapePathPage(QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void TapePathPage::Apply()
{
qApp->TapeSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
qApp->TapeSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
qApp->TapeSettings()->SetPathTemplate(pathTable->item(2, 1)->text());
VTapeSettings *settings = qApp->TapeSettings();
settings->SetPathIndividualMeasurements(pathTable->item(0, 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");
pathTable->setHorizontalHeaderLabels(tableHeader);
const VTapeSettings *settings = qApp->TapeSettings();
{
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathIndividualMeasurements());
item->setToolTip(qApp->TapeSettings()->GetPathIndividualMeasurements());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
item->setToolTip(settings->GetPathIndividualMeasurements());
pathTable->setItem(0, 1, item);
}
{
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathStandardMeasurements());
item->setToolTip(qApp->TapeSettings()->GetPathStandardMeasurements());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
item->setToolTip(settings->GetPathStandardMeasurements());
pathTable->setItem(1, 1, item);
}
{
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Templates")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathTemplate());
item->setToolTip(qApp->TapeSettings()->GetPathTemplate());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
item->setToolTip(settings->GetPathTemplate());
pathTable->setItem(2, 1, item);
}

View File

@ -236,31 +236,29 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column)
}
else if (item->childCount() == 0 || column == -1)
{
if (item->parent() == nullptr)
QTreeWidgetItem *parent = item->parent();
if (parent == nullptr)
{
return;
}
for (int j = 0; j < item->parent()->childCount(); ++j)
for (int j = 0; j < parent->childCount(); ++j)
{
if (j != item->parent()->indexOfChild(item)
&& item->checkState(0) != item->parent()->child(j)->checkState(0))
if (j != parent->indexOfChild(item)
&& item->checkState(0) != parent->child(j)->checkState(0))
{
diff = true;
}
}
if (diff)
{
item->parent()->setCheckState(0, Qt::PartiallyChecked);
parent->setCheckState(0, Qt::PartiallyChecked);
}
else
{
item->parent()->setCheckState(0, item->checkState(0));
parent->setCheckState(0, item->checkState(0));
}
if (item->parent() != nullptr)
{
UpdateChecks(item->parent(), -1);
}
UpdateChecks(parent, -1);
}
}
@ -286,7 +284,8 @@ void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
}
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));
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>")
.arg(iconPath)
.arg(number)
.arg(qApp->TrVars()->GuiText(name))
.arg(qApp->TrVars()->Description(name));
.arg(trv->GuiText(name))
.arg(trv->Description(name));
ui->textEdit->setHtml(text);
}

View File

@ -158,7 +158,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
break;
#endif
case QtDebugMsg:
Q_UNREACHABLE();
Q_UNREACHABLE(); //-V501
default:
break;
}
@ -249,7 +249,7 @@ bool MApplication::notify(QObject *receiver, QEvent *event)
}
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()));
exit(V_EX_DATAERR);
}

View File

@ -109,16 +109,8 @@ TMainWindow::TMainWindow(QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
TMainWindow::~TMainWindow()
{
if (data != nullptr)
{
delete data;
}
if (m != nullptr)
{
delete m;
}
delete ui;
}
@ -2411,20 +2403,22 @@ void TMainWindow::MeasurementReadOnly(bool ro)
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::ReadSettings()
{
restoreGeometry(qApp->TapeSettings()->GetGeometry());
restoreState(qApp->TapeSettings()->GetWindowState());
restoreState(qApp->TapeSettings()->GetToolbarsState(), APP_VERSION);
const VTapeSettings *settings = qApp->TapeSettings();
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
// Stack limit
//qApp->getUndoStack()->setUndoLimit(qApp->TapeSettings()->GetUndoCount());
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::WriteSettings()
{
qApp->TapeSettings()->SetGeometry(saveGeometry());
qApp->TapeSettings()->SetWindowState(saveState());
qApp->TapeSettings()->SetToolbarsState(saveState(APP_VERSION));
VTapeSettings *settings = qApp->TapeSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(APP_VERSION));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -307,7 +307,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
}
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()));
exit(V_EX_DATAERR);
}

View File

@ -591,7 +591,7 @@ void VToolOptionsPropertyBrowser::SetPointName2(const QString &name)
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant value)
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value)
{
if (Tool *i = qgraphicsitem_cast<Tool *>(currentItem))
{

View File

@ -75,7 +75,7 @@ private:
void SetPointName2(const QString &name);
template<class Tool>
void SetCrossCirclesPoint(const QVariant value);
void SetCrossCirclesPoint(const QVariant &value);
template<class Tool>
void AddPropertyPointName(Tool *i, const QString &propertyName);

View File

@ -57,17 +57,18 @@ CommunityPage::CommunityPage(QWidget *parent):
//---------------------------------------------------------------------------------------------------------------------
void CommunityPage::Apply()
{
qApp->ValentinaSettings()->SetServer(this->server->text());
qApp->ValentinaSettings()->SetServerSecure(this->secureComm->isChecked());
qApp->ValentinaSettings()->SetProxy(this->useProxy->isChecked());
qApp->ValentinaSettings()->SetProxyAddress(this->proxyAddress->text());
qApp->ValentinaSettings()->SetProxyPort(this->proxyPort->text());
qApp->ValentinaSettings()->SetProxyUser(this->proxyUser->text());
qApp->ValentinaSettings()->SetProxyPass(this->proxyPass->text());
VSettings *settings = qApp->ValentinaSettings();
settings->SetServer(this->server->text());
settings->SetServerSecure(this->secureComm->isChecked());
settings->SetProxy(this->useProxy->isChecked());
settings->SetProxyAddress(this->proxyAddress->text());
settings->SetProxyPort(this->proxyPort->text());
settings->SetProxyUser(this->proxyUser->text());
settings->SetProxyPass(this->proxyPass->text());
qApp->ValentinaSettings()->SetUsername(this->username->text());
qApp->ValentinaSettings()->SetSavePassword(this->savePassword->isChecked());
qApp->ValentinaSettings()->SetUserPassword(this->userpassword->text());
settings->SetUsername(this->username->text());
settings->SetSavePassword(this->savePassword->isChecked());
settings->SetUserPassword(this->userpassword->text());
}
@ -136,12 +137,13 @@ QGroupBox *CommunityPage::ProxyGroup()
QFormLayout *proxyLayout = new QFormLayout;
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->ValentinaSettings()->GetProxy(), tr("Use Proxy"));
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->ValentinaSettings()->GetProxyAddress(),
const VSettings *settings = qApp->ValentinaSettings();
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy"));
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
tr("Proxy address"));
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->ValentinaSettings()->GetProxyPort(), tr("Proxy port"));
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->ValentinaSettings()->GetProxyUser(), tr("Proxy user"));
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->ValentinaSettings()->GetProxyPass(), tr("Proxy pass"));
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port"));
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user"));
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass"));
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
this->ProxyCheckChanged();
@ -156,11 +158,10 @@ QGroupBox *CommunityPage::UserGroup()
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
QFormLayout *userLayout = new QFormLayout;
CommunityPage::add_lineedit(&this->username, userLayout, qApp->ValentinaSettings()->GetUsername(), tr("User Name"));
CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->ValentinaSettings()->GetSavePassword(),
tr("Save password"));
CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->ValentinaSettings()->GetUserPassword(),
tr("Password"));
const VSettings *settings = qApp->ValentinaSettings();
CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name"));
CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password"));
CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password"));
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
this->PasswordCheckChanged();

View File

@ -67,23 +67,24 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::Apply()
{
qApp->ValentinaSettings()->SetAutosaveState(autoSaveCheck->isChecked());
qApp->ValentinaSettings()->SetAutosaveTime(autoTime->value());
VSettings *settings = qApp->ValentinaSettings();
settings->SetAutosaveState(autoSaveCheck->isChecked());
settings->SetAutosaveTime(autoTime->value());
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
SCASSERT(autoSaveTimer);
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();
qApp->ValentinaSettings()->SetOsSeparator(osOptionCheck->isChecked());
qApp->ValentinaSettings()->SetSendReportState(sendReportCheck->isChecked());
qApp->ValentinaSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
qApp->ValentinaSettings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
settings->SetOsSeparator(osOptionCheck->isChecked());
settings->SetSendReportState(sendReportCheck->isChecked());
settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
settings->SetToolBarStyle(toolBarStyleCheck->isChecked());
if (langChanged)
{
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
qApp->ValentinaSettings()->SetLocale(locale);
settings->SetLocale(locale);
langChanged = false;
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
QApplication::applicationName();
@ -92,7 +93,7 @@ void ConfigurationPage::Apply()
if (this->unitChanged)
{
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
qApp->ValentinaSettings()->SetUnit(unit);
settings->SetUnit(unit);
this->unitChanged = false;
const QString text = tr("Default unit updated and will be used the next pattern creation");
QMessageBox::information(this, QApplication::applicationName(), text);
@ -100,7 +101,7 @@ void ConfigurationPage::Apply()
if (labelLangChanged)
{
const QString locale = qvariant_cast<QString>(labelCombo->itemData(labelCombo->currentIndex()));
qApp->ValentinaSettings()->SetLabelLanguage(locale);
settings->SetLabelLanguage(locale);
labelLangChanged = false;
}
}
@ -181,7 +182,8 @@ QGroupBox *ConfigurationPage::LangGroup()
}
// 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)
{
langCombo->setCurrentIndex(index);
@ -197,7 +199,7 @@ QGroupBox *ConfigurationPage::LangGroup()
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
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;
separatorLayout->addWidget(separatorLabel);
@ -212,7 +214,7 @@ QGroupBox *ConfigurationPage::LangGroup()
this->unitCombo->addItem(tr("Inches"), "in");
// set default unit
qint32 indexUnit = this->unitCombo->findData(qApp->ValentinaSettings()->GetUnit());
qint32 indexUnit = this->unitCombo->findData(settings->GetUnit());
if (indexUnit != -1)
{
this->unitCombo->setCurrentIndex(indexUnit);
@ -231,7 +233,7 @@ QGroupBox *ConfigurationPage::LangGroup()
SetLabelComboBox(VApplication::LabelLanguages());
index = labelCombo->findData(qApp->ValentinaSettings()->GetLabelLanguage());
index = labelCombo->findData(settings->GetLabelLanguage());
if (index != -1)
{
labelCombo->setCurrentIndex(index);

View File

@ -62,11 +62,12 @@ PathPage::PathPage(QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
void PathPage::Apply()
{
qApp->ValentinaSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
qApp->ValentinaSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
qApp->ValentinaSettings()->SetPathPattern(pathTable->item(2, 1)->text());
qApp->ValentinaSettings()->SetPathLayout(pathTable->item(3, 1)->text());
qApp->ValentinaSettings()->SetPathTemplate(pathTable->item(4, 1)->text());
VSettings *settings = qApp->ValentinaSettings();
settings->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
settings->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
settings->SetPathPattern(pathTable->item(2, 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");
pathTable->setHorizontalHeaderLabels(tableHeader);
const VSettings *settings = qApp->ValentinaSettings();
{
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathIndividualMeasurements());
item->setToolTip(qApp->ValentinaSettings()->GetPathIndividualMeasurements());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
item->setToolTip(settings->GetPathIndividualMeasurements());
pathTable->setItem(0, 1, item);
}
{
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathStandardMeasurements());
item->setToolTip(qApp->ValentinaSettings()->GetPathStandardMeasurements());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
item->setToolTip(settings->GetPathStandardMeasurements());
pathTable->setItem(1, 1, item);
}
{
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathPattern());
item->setToolTip(qApp->ValentinaSettings()->GetPathPattern());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathPattern());
item->setToolTip(settings->GetPathPattern());
pathTable->setItem(2, 1, item);
}
{
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathLayout());
item->setToolTip(qApp->ValentinaSettings()->GetPathLayout());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathLayout());
item->setToolTip(settings->GetPathLayout());
pathTable->setItem(3, 1, item);
}
{
pathTable->setItem(4, 0, new QTableWidgetItem(tr("Templates")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathTemplate());
item->setToolTip(qApp->ValentinaSettings()->GetPathTemplate());
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
item->setToolTip(settings->GetPathTemplate());
pathTable->setItem(4, 1, item);
}

View File

@ -58,17 +58,18 @@ PatternPage::PatternPage(QWidget *parent):
//---------------------------------------------------------------------------------------------------------------------
void PatternPage::Apply()
{
qApp->ValentinaSettings()->SetUser(userName->text());
VSettings *settings = qApp->ValentinaSettings();
settings->SetUser(userName->text());
// Scene antialiasing
qApp->ValentinaSettings()->SetGraphicalOutput(graphOutputCheck->isChecked());
settings->SetGraphicalOutput(graphOutputCheck->isChecked());
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, 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
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
* prints a warning and does nothing.*/
qApp->ValentinaSettings()->SetUndoCount(undoCount->value());
settings->SetUndoCount(undoCount->value());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -211,7 +211,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
switch ( tool.getTypeTool() )
{
case Tool::Arrow:
Q_UNREACHABLE();
Q_UNREACHABLE(); //-V501
break;
case Tool::BasePoint:
{

View File

@ -158,7 +158,7 @@ void DialogIncrements::FillIncrements()
//---------------------------------------------------------------------------------------------------------------------
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);

View File

@ -80,7 +80,7 @@ private:
Ui::DialogIncrements *ui;
/** @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 */
VPattern *doc;
@ -88,7 +88,7 @@ private:
int formulaBaseHeight;
template <typename T>
void FillTable(const QMap<QString, T> varTable, QTableWidget *table);
void FillTable(const QMap<QString, T> &varTable, QTableWidget *table);
void FillIncrements();
void FillLengthsLines();

View File

@ -694,34 +694,35 @@ void DialogLayoutSettings::MinimumLayoutSize()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::ReadSettings()
{
const VSettings *settings = qApp->ValentinaSettings();
SetLayoutWidth(settings->GetLayoutWidth());
SetShift(settings->GetLayoutShift());
SetLayoutWidth(qApp->ValentinaSettings()->GetLayoutWidth());
SetShift(qApp->ValentinaSettings()->GetLayoutShift());
const qreal width = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
const qreal height = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
const qreal width = UnitConvertor(settings->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
const qreal height = UnitConvertor(settings->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
SheetSize(QSizeF(width, height));
SetGroup(qApp->ValentinaSettings()->GetLayoutGroup());
SetRotate(qApp->ValentinaSettings()->GetLayoutRotate());
SetIncrease(qApp->ValentinaSettings()->GetLayoutRotationIncrease());
SetAutoCrop(qApp->ValentinaSettings()->GetLayoutAutoCrop());
SetSaveLength(qApp->ValentinaSettings()->GetLayoutSaveLength());
SetUnitePages(qApp->ValentinaSettings()->GetLayoutUnitePages());
SetGroup(settings->GetLayoutGroup());
SetRotate(settings->GetLayoutRotate());
SetIncrease(settings->GetLayoutRotationIncrease());
SetAutoCrop(settings->GetLayoutAutoCrop());
SetSaveLength(settings->GetLayoutSaveLength());
SetUnitePages(settings->GetLayoutUnitePages());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::WriteSettings() const
{
qApp->ValentinaSettings()->SetLayoutWidth(GetLayoutWidth());
qApp->ValentinaSettings()->SetLayoutGroup(GetGroup());
qApp->ValentinaSettings()->SetLayoutPaperHeight(GetPaperHeight());
qApp->ValentinaSettings()->SetLayoutPaperWidth(GetPaperWidth());
qApp->ValentinaSettings()->SetLayoutShift(GetShift());
qApp->ValentinaSettings()->SetLayoutRotate(GetRotate());
qApp->ValentinaSettings()->SetLayoutRotationIncrease(GetIncrease());
qApp->ValentinaSettings()->SetLayoutAutoCrop(GetAutoCrop());
qApp->ValentinaSettings()->SetLayoutSaveLength(IsSaveLength());
qApp->ValentinaSettings()->SetLayoutUnitePages(IsUnitePages());
VSettings *settings = qApp->ValentinaSettings();
settings->SetLayoutWidth(GetLayoutWidth());
settings->SetLayoutGroup(GetGroup());
settings->SetLayoutPaperHeight(GetPaperHeight());
settings->SetLayoutPaperWidth(GetPaperWidth());
settings->SetLayoutShift(GetShift());
settings->SetLayoutRotate(GetRotate());
settings->SetLayoutRotationIncrease(GetIncrease());
settings->SetLayoutAutoCrop(GetAutoCrop());
settings->SetLayoutSaveLength(IsSaveLength());
settings->SetLayoutUnitePages(IsUnitePages());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -589,23 +589,11 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
ChangesStackElement* index = this->changeStackRoot;
if (changeStackRoot == elmt)
{
if (elmt->newText != nullptr)
{
delete elmt->newText;
}
if (elmt->newValue != nullptr)
{
delete elmt->newValue;
}
if (elmt->oldText != nullptr)
{
delete elmt->oldText;
}
if (elmt->oldValue != nullptr)
{
delete elmt->oldValue;
}
this->changeStackRoot = elmt->next;
if (this->changeStackLast == elmt)
{
@ -627,22 +615,10 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
SCASSERT(index->next != nullptr);
return;
}
if (index->next->newText != nullptr)
{
delete index->next->newText;
}
if (index->next->newValue != nullptr)
{
delete index->next->newValue;
}
if (index->next->oldText != nullptr)
{
delete index->next->oldText;
}
if (index->next->oldValue != nullptr)
{
delete index->next->oldValue;
}
index->next=index->next->next;
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)
//QMessageBox::information(this, "valueTextEdited", QString("%1").arg(newtext));
@ -933,15 +909,9 @@ void DialogPatternXmlEdit::ClearStack()
{
ChangesStackElement * tmp;
while (changeStackRoot != nullptr)
{
if (changeStackRoot->newText != nullptr)
{
delete changeStackRoot->newText;
}
if (changeStackRoot->newValue != nullptr)
{
delete changeStackRoot->newValue;
}
tmp=changeStackRoot;
changeStackRoot=changeStackRoot->next;
delete tmp;
@ -1084,13 +1054,14 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML
{
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))
{
ui->comboBox_Base_Selection->addItem(tNode.attributes().item(i).nodeValue(),
ui->comboBox_Base_Selection->addItem(node.nodeValue(),
QVariant(rootBasesNum));
rootBases[rootBasesNum]=new VXMLTreeElement(
QString("Drawing %1").arg(tNode.attributes().item(i).nodeValue()),
QString("Drawing %1").arg(node.nodeValue()),
VXMLTreeElement::TypeRoot, tNode, false);
rootBasesNum++;
//QStandardItem* rootNode = (QStandardItem*) rootBases[rootBasesNum]->invisibleRootItem();
@ -1124,11 +1095,12 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML
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);
tElement2->SetTreeNodeValue(tNode.attributes().item(i).nodeValue());
tElement2->SetTreeNodeValue(attr.item(i).nodeValue());
tElement->appendRow(tElement2);
xmlmodel->appendchain(tElement2);
}
@ -1172,22 +1144,12 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt)
if (last == nullptr)
{ // first element
current = new TreeElementchain;
if (current == nullptr)
{
SCASSERT(current != nullptr);
// TODO : throw exception
}
current->elmt=elmt;
current->next=nullptr;
last=items=current;
return;
}
TreeElementchain* temp= new TreeElementchain;
if (temp == nullptr)
{
SCASSERT(temp != nullptr);
// TODO : throw exception
}
temp->elmt=elmt;
temp->next=nullptr;
last->next=temp;

View File

@ -1540,7 +1540,7 @@ void MainWindow::CancelTool()
ui->actionStopTool->setEnabled(true);
return;
case Tool::BasePoint:
Q_UNREACHABLE();
Q_UNREACHABLE(); //-V501
//Nothing to do here because we can't create this tool from main window.
break;
case Tool::EndLine:
@ -2231,7 +2231,7 @@ void MainWindow::FullParseFile()
}
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()));
SetEnabledGUI(false);
if (not VApplication::CheckGUI())
@ -2836,7 +2836,8 @@ void MainWindow::setCurrentFile(const QString &fileName)
else
{
qCDebug(vMainWindow, "Updating recent file list.");
QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
VSettings *settings = qApp->ValentinaSettings();
QStringList files = settings->GetRecentFileList();
files.removeAll(fileName);
files.prepend(fileName);
while (files.size() > MaxRecentFiles)
@ -2844,14 +2845,14 @@ void MainWindow::setCurrentFile(const QString &fileName)
files.removeLast();
}
qApp->ValentinaSettings()->SetRecentFileList(files);
settings->SetRecentFileList(files);
UpdateRecentFileActions();
qCDebug(vMainWindow, "Updating restore file list.");
QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
QStringList restoreFiles = settings->GetRestoreFileList();
restoreFiles.removeAll(fileName);
restoreFiles.prepend(fileName);
qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
settings->SetRestoreFileList(restoreFiles);
}
shownName+="[*]";
setWindowTitle(shownName);
@ -2875,17 +2876,18 @@ QString MainWindow::strippedName(const QString &fullFileName)
void MainWindow::ReadSettings()
{
qCDebug(vMainWindow, "Reading settings.");
restoreGeometry(qApp->ValentinaSettings()->GetGeometry());
restoreState(qApp->ValentinaSettings()->GetWindowState());
restoreState(qApp->ValentinaSettings()->GetToolbarsState(), APP_VERSION);
const VSettings *settings = qApp->ValentinaSettings();
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
// Scene antialiasing
const bool graphOutputValue = qApp->ValentinaSettings()->GetGraphicalOutput();
const bool graphOutputValue = settings->GetGraphicalOutput();
ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
// Stack limit
qApp->getUndoStack()->setUndoLimit(qApp->ValentinaSettings()->GetUndoCount());
qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
// Text under tool buton icon
ToolBarStyles();
@ -2899,9 +2901,10 @@ void MainWindow::WriteSettings()
{
ActionDraw(true);
qApp->ValentinaSettings()->SetGeometry(saveGeometry());
qApp->ValentinaSettings()->SetWindowState(saveState());
qApp->ValentinaSettings()->SetToolbarsState(saveState(APP_VERSION));
VSettings *setings = qApp->ValentinaSettings();
setings->SetGeometry(saveGeometry());
setings->SetWindowState(saveState());
setings->SetToolbarsState(saveState(APP_VERSION));
}
//---------------------------------------------------------------------------------------------------------------------
@ -3004,7 +3007,7 @@ void MainWindow::LastUsedTool()
ArrowTool();
break;
case Tool::BasePoint:
Q_UNREACHABLE();
Q_UNREACHABLE(); //-V501
//Nothing to do here because we can't create this tool from main window.
break;
case Tool::EndLine:
@ -3849,7 +3852,8 @@ void MainWindow::SetHeight(const QString &text)
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ProcessCMD()
{
auto args = qApp->CommandLine()->OptInputFileNames();
const VCommandLinePtr cmd = qApp->CommandLine();
auto args = cmd->OptInputFileNames();
//Before we load pattern show window.
if (VApplication::CheckGUI())
@ -3869,33 +3873,33 @@ void MainWindow::ProcessCMD()
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())
{
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)
{
DoExport(qApp->CommandLine());
DoExport(cmd);
return; // process only one input file
}
break;

View File

@ -419,11 +419,11 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
{
idetail.next();
VLayoutDetail det = VLayoutDetail();
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern),
idetail.value().getSeamAllowance());
det.setName(idetail.value().getName());
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
const VDetail &d = idetail.value();
det.SetCountourPoints(d.ContourPoints(pattern));
det.SetSeamAllowencePoints(d.SeamAllowancePoints(pattern), d.getSeamAllowance());
det.setName(d.getName());
det.setWidth(qApp->toPixel(d.getWidth()));
listDetails.append(det);
}
@ -935,20 +935,21 @@ void MainWindowsNoGUI::UnitePages()
for (int i = 0; i < papers.size(); ++i)
{
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
SCASSERT(paper != nullptr)
if (length + paper->rect().height() <= QIMAGE_MAX)
SCASSERT(paper != nullptr);
const QRectF rec = paper->rect();
if (length + rec.height() <= QIMAGE_MAX)
{
UniteDetails(j, nDetails, length, i);
length += paper->rect().height();
UnitePapers(j, nPapers, paper->rect().width(), length);
length += rec.height();
UnitePapers(j, nPapers, rec.width(), length);
}
else
{
length = 0; // Strat new paper
++j;// New paper
UniteDetails(j, nDetails, length, i);
length += paper->rect().height();
UnitePapers(j, nPapers, paper->rect().width(), length);
length += rec.height();
UnitePapers(j, nPapers, rec.width(), length);
}
}

View File

@ -265,7 +265,7 @@ void VPattern::setCurrentData()
*/
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);
ToolExists(id);
VDataTool *tool = tools.value(id);
@ -355,7 +355,7 @@ void VPattern::LiteParseTree(const Document &parse)
}
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()));
emit SetEnabledGUI(false);
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)
{
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
{
VDetail detail;
@ -620,7 +620,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
*/
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();
while (domNode.isNull() == false)
{
@ -675,8 +675,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const Document &parse, const QString &type)
{
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
QStringList points = QStringList() << VToolBasePoint::ToolType /*0*/
<< VToolEndLine::ToolType /*1*/
@ -785,7 +785,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
const Document &parse)
{
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
{
quint32 id = 0;
@ -904,7 +904,7 @@ QString VPattern::GetLabelBase(quint32 index) const
void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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;
try
@ -949,7 +949,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -998,7 +998,7 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1042,7 +1042,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1087,7 +1087,7 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do
void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1132,7 +1132,7 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen
void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1177,7 +1177,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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
{
@ -1207,7 +1207,7 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme
void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1249,7 +1249,7 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d
//---------------------------------------------------------------------------------------------------------------------
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
{
@ -1277,7 +1277,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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
{
@ -1308,7 +1308,7 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom
void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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
{
@ -1339,7 +1339,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
const Document &parse)
{
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
{
@ -1367,7 +1367,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1410,7 +1410,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1454,7 +1454,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
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
{
@ -1496,7 +1496,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
const Document &parse)
{
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
{
@ -1546,7 +1546,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
const Document &parse)
{
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
{
@ -1594,7 +1594,7 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const
const Document &parse)
{
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
{
@ -1626,7 +1626,7 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
const Document &parse)
{
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
{
@ -1668,7 +1668,7 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo
const Document &parse)
{
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
{
@ -1708,7 +1708,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
const Document &parse)
{
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
{
@ -1739,7 +1739,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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
{
@ -1781,7 +1781,7 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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
{
@ -1812,7 +1812,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &dom
void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{
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
{
@ -1864,7 +1864,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
//---------------------------------------------------------------------------------------------------------------------
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
{
@ -1890,7 +1890,7 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
//---------------------------------------------------------------------------------------------------------------------
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
{
@ -1960,7 +1960,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
//---------------------------------------------------------------------------------------------------------------------
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
{
@ -2145,8 +2145,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
const QString &type)
{
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty");
QStringList arcs = QStringList() << VToolArc::ToolType /*0*/
<< VNodeArc::ToolType /*1*/
@ -2604,7 +2604,7 @@ QRectF VPattern::ToolBoundingRect(const QRectF &rec, const 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);
VDataTool *tool = tools.value(id);
SCASSERT(tool != nullptr);
@ -2618,7 +2618,7 @@ void VPattern::IncrementReferens(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);
VDataTool *tool = tools.value(id);
SCASSERT(tool != nullptr);

View File

@ -44,7 +44,7 @@
*/
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");
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -37,7 +37,7 @@
VExceptionConversionError::VExceptionConversionError(const QString &what, const QString &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");
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -41,8 +41,8 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS
const QDomElement &domElement)
: 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(name.isEmpty() == false, Q_FUNC_INFO, "Parameter name is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty");
QTextStream stream(&tagText);
domElement.save(stream, 4);
tagName = domElement.tagName();

View File

@ -39,7 +39,7 @@
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement)
: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);
domElement.save(stream, 4);
tagName = domElement.tagName();

View File

@ -39,7 +39,7 @@
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement)
: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);
domElement.save(stream, 4);
tagName = domElement.tagName();

View File

@ -170,7 +170,7 @@ QStringList VAbstractPattern::ListMeasurements() const
*/
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)
{
this->nameActivPP = name;
@ -231,7 +231,7 @@ bool VAbstractPattern::GetActivDrawElement(QDomElement &element) 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 );
if (elements.size() == 0)
{
@ -260,7 +260,7 @@ bool VAbstractPattern::CheckExistNamePP(const QString &name) 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;
if (GetActivDrawElement(drawElement))
{
@ -328,8 +328,8 @@ QDomElement VAbstractPattern::GetPPElement(const QString &name)
*/
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(oldName.isEmpty() == false, "SetNamePP", "old name pattern piece is empty");
Q_ASSERT_X(not newName.isEmpty(), Q_FUNC_INFO, "new name pattern piece is empty");
Q_ASSERT_X(not oldName.isEmpty(), Q_FUNC_INFO, "old name pattern piece is empty");
if (CheckExistNamePP(oldName) == false)
{
@ -373,7 +373,7 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa
*/
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())
{
return false;
@ -422,7 +422,7 @@ VDataTool *VAbstractPattern::getTool(const quint32 &id)
*/
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);
tools.insert(id, tool);
}
@ -913,7 +913,7 @@ void VAbstractPattern::ToolExists(const quint32 &id) const
*/
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;
emit ChangedActivPP(name);
}

View File

@ -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
{
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591
bool ok = false;
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
{
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QString parametr;
bool val = true;
@ -279,8 +279,8 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
QString VDomDocument::GetParametrString(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(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
const QString parameter = domElement.attribute(name, defValue);
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
{
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
bool ok = false;
qreal param = 0;
@ -338,7 +338,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri
*/
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;

View File

@ -841,13 +841,13 @@ void QmuParserBase::ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type>
while (a_stOpt.size() && a_stOpt.top().GetCode()==cmELSE)
{
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
token_type vVal2 = a_stVal.pop();
Q_ASSERT(a_stOpt.size()>0);
Q_ASSERT(a_stVal.size()>=2);
Q_ASSERT(a_stOpt.size()>0); //-V654
Q_ASSERT(a_stVal.size()>=2); //-V654
// it then else is a ternary operator Pop all three values from the value s
// 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);
token_type opIf = a_stOpt.pop();
Q_ASSERT(opElse.GetCode()==cmELSE);
Q_ASSERT(opIf.GetCode()==cmIF);
Q_ASSERT(opElse.GetCode()==cmELSE); //-V654
Q_ASSERT(opIf.GetCode()==cmIF); //-V654
m_vRPN.AddIfElse(cmENDIF);
} // while pending if-else-clause found
@ -877,7 +877,7 @@ void QmuParserBase::ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type>
}
else
{
Q_ASSERT(a_stVal.size()>=2);
Q_ASSERT(a_stVal.size()>=2); //-V654
token_type valTok1 = a_stVal.pop(),
valTok2 = a_stVal.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
{
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 (stOpt.top().GetCode()==cmOPRT_INFIX)
if (code==cmOPRT_INFIX)
{
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
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
{
@ -1332,21 +1330,30 @@ void QmuParserBase::CreateRPN() const
// Next three are different kind of value entries
//
case cmSTRING:
{
opt.SetIdx(m_vStringBuf.size()); // Assign buffer index to token
stVal.push(opt);
m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
const QString &str = opt.GetAsString();
m_vStringBuf.push_back(str); // Store string in internal buffer
m_Tokens.insert(m_pTokenReader->GetPos()-str.length(), str);
break;
}
case cmVAR:
{
stVal.push(opt);
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;
}
case cmVAL:
{
stVal.push(opt);
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;
}
case cmELSE:
m_nIfElseCounter--;
if (m_nIfElseCounter<0)
@ -1388,7 +1395,8 @@ void QmuParserBase::CreateRPN() const
ApplyRemainingOprt(stOpt, stVal);
// 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 there is either a function or a sign pending
@ -1401,17 +1409,17 @@ void QmuParserBase::CreateRPN() const
stOpt.pop(); // Take opening bracket from stack
if (iArgCount>1 && ( stOpt.size()==0 || (stOpt.top().GetCode()!=cmFUNC &&
stOpt.top().GetCode()!=cmFUNC_BULK &&
stOpt.top().GetCode()!=cmFUNC_STR) ) )
if (iArgCount>1 && ( stOpt.size()==0 || (topToken.GetCode()!=cmFUNC &&
topToken.GetCode()!=cmFUNC_BULK &&
topToken.GetCode()!=cmFUNC_STR) ) )
{
Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
}
// The opening bracket was popped from the stack now check if there
// was a function before this bracket
if (stOpt.size() && stOpt.top().GetCode()!=cmOPRT_INFIX && stOpt.top().GetCode()!=cmOPRT_BIN &&
stOpt.top().GetFuncAddr()!=0)
if (stOpt.size() && topToken.GetCode()!=cmOPRT_INFIX && topToken.GetCode()!=cmOPRT_BIN &&
topToken.GetFuncAddr()!=0)
{
ApplyFunc(stOpt, stVal, iArgCount);
}
@ -1445,14 +1453,16 @@ void QmuParserBase::CreateRPN() const
case cmLOR:
case cmASSIGN:
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);
if (stOpt.top().GetCode()==opt.GetCode())
if (topToken.GetCode()==opt.GetCode())
{
// Deal with operator associativity
EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
@ -1467,7 +1477,7 @@ void QmuParserBase::CreateRPN() const
// In case the operators are not equal the precedence decides alone...
break;
}
if (stOpt.top().GetCode()==cmOPRT_INFIX)
if (topToken.GetCode()==cmOPRT_INFIX)
{
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
stOpt.push(opt);
break;
}
//
// 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
Q_ASSERT(stArgCount.size()==1);
Q_ASSERT(stArgCount.size()==1); //-V654
m_nFinalResultIdx = stArgCount.top();
if (m_nFinalResultIdx==0)
{
@ -1788,13 +1799,14 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
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
{
switch ( stOprt.top().GetCode())
switch ( topToken.GetCode())
{
case cmVAR:
qDebug() << "VAR\n";
@ -1803,16 +1815,16 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
qDebug() << "VAL\n";
break;
case cmFUNC:
qDebug() << "FUNC \"" << stOprt.top().GetAsString() << "\"\n";
qDebug() << "FUNC \"" << topToken.GetAsString() << "\"\n";
break;
case cmFUNC_BULK:
qDebug() << "FUNC_BULK \"" << stOprt.top().GetAsString() << "\"\n";
qDebug() << "FUNC_BULK \"" << topToken.GetAsString() << "\"\n";
break;
case cmOPRT_INFIX:
qDebug() << "OPRT_INFIX \"" << stOprt.top().GetAsString() << "\"\n";
qDebug() << "OPRT_INFIX \"" << topToken.GetAsString() << "\"\n";
break;
case cmOPRT_BIN:
qDebug() << "OPRT_BIN \"" << stOprt.top().GetAsString() << "\"\n";
qDebug() << "OPRT_BIN \"" << topToken.GetAsString() << "\"\n";
break;
case cmFUNC_STR:
qDebug() << "FUNC_STR\n";
@ -1839,7 +1851,7 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
qDebug() << "ENDIF\n";
break;
default:
qDebug() << stOprt.top().GetCode() << " ";
qDebug() << topToken.GetCode() << " ";
break;
}
}

View File

@ -232,7 +232,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
// cmVAL cmVAL cmADD
// where cmADD can stand fopr any binary operator applied to
// 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);
bOptimized = true;
@ -243,17 +243,17 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
{
case cmPOW:
// 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;
}
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;
}
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;
}
@ -270,69 +270,69 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
case cmADD:
// Simple optimization based on pattern recognition for a shitload of different
// bytecode combinations of addition/subtraction
if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) ||
(m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) ||
(m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) ||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) ||
(m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR &&
m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
(m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVARMUL
&& m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAR &&
m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVARMUL &&
m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) )
if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) ||
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) ||
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL) ||
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAL) ||
(m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAR &&
m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) || //-V807
(m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVARMUL
&& m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) ||
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAR &&
m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) ||
(m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
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) ||
(m_vRPN[sz-2].Val.ptr!=nullptr && m_vRPN[sz-1].Val.ptr==nullptr) ||
(m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) );
assert( (m_vRPN.at(sz-2).Val.ptr==nullptr && m_vRPN.at(sz-1).Val.ptr!=nullptr) ||
(m_vRPN.at(sz-2).Val.ptr!=nullptr && m_vRPN.at(sz-1).Val.ptr==nullptr) ||
(m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) );
m_vRPN[sz-2].Cmd = cmVARMUL;
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
reinterpret_cast<qlonglong>(m_vRPN[sz-2].Val.ptr) |
reinterpret_cast<qlonglong>(m_vRPN[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.data += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data; // multiplikatior
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>( //-V807
reinterpret_cast<qlonglong>(m_vRPN.at(sz-2).Val.ptr) |
reinterpret_cast<qlonglong>(m_vRPN.at(sz-1).Val.ptr)); // variable
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.at(sz-1).Val.data; // multiplikatior
m_vRPN.pop_back();
bOptimized = true;
}
break;
case cmMUL:
if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) ||
(m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) )
if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) ||
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) )
{
m_vRPN[sz-2].Cmd = cmVARMUL;
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
reinterpret_cast<qlonglong>(m_vRPN[sz-2].Val.ptr) |
reinterpret_cast<qlonglong>(m_vRPN[sz-1].Val.ptr));
m_vRPN[sz-2].Val.data = m_vRPN[sz-2].Val.data2 + m_vRPN[sz-1].Val.data2;
reinterpret_cast<qlonglong>(m_vRPN.at(sz-2).Val.ptr) |
reinterpret_cast<qlonglong>(m_vRPN.at(sz-1).Val.ptr));
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.pop_back();
bOptimized = true;
}
else if ( (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) ||
(m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) )
else if ( (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL) ||
(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
m_vRPN[sz-2].Cmd = cmVARMUL;
m_vRPN[sz-2].Val.ptr = reinterpret_cast<qreal*>(
reinterpret_cast<qlonglong>(m_vRPN[sz-2].Val.ptr) |
reinterpret_cast<qlonglong>(m_vRPN[sz-1].Val.ptr));
if (m_vRPN[sz-1].Cmd == cmVAL)
reinterpret_cast<qlonglong>(m_vRPN.at(sz-2).Val.ptr) |
reinterpret_cast<qlonglong>(m_vRPN.at(sz-1).Val.ptr));
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.data2 *= 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.at(sz-1).Val.data2;
}
else
{
m_vRPN[sz-2].Val.data = m_vRPN[sz-1].Val.data * m_vRPN[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.data = m_vRPN.at(sz-1).Val.data * m_vRPN.at(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();
bOptimized = true;
}
else if (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR &&
m_vRPN[sz-1].Val.ptr == m_vRPN[sz-2].Val.ptr)
else if (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAR &&
m_vRPN.at(sz-1).Val.ptr == m_vRPN.at(sz-2).Val.ptr)
{
// Optimization: a*a -> a^2
m_vRPN[sz-2].Cmd = cmVARPOW2;
@ -341,12 +341,12 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
}
break;
case cmDIV:
if (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL &&
(qFuzzyCompare(m_vRPN[sz-1].Val.data2+1, 1+0)==false))
if (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
(qFuzzyCompare(m_vRPN.at(sz-1).Val.data2+1, 1+0)==false))
{
// Optimization: 4*a/2 -> 2*a
m_vRPN[sz-2].Val.data /= m_vRPN[sz-1].Val.data2;
m_vRPN[sz-2].Val.data2 /= 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.at(sz-1).Val.data2;
m_vRPN.pop_back();
bOptimized = true;
}
@ -550,37 +550,37 @@ void QmuParserByteCode::AsciiDump()
}
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";
switch (m_vRPN[i].Cmd)
switch (m_vRPN.at(i).Cmd)
{
case cmVAL:
qDebug() << "VAL \t" << "[" << m_vRPN[i].Val.data2 << "]\n";
qDebug() << "VAL \t" << "[" << m_vRPN.at(i).Val.data2 << "]\n";
break;
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;
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;
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;
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;
case cmVARMUL:
qDebug() << "VARMUL \t" << "[ADDR: 0x" << QString::number(*m_vRPN[i].Val.ptr, 'f', 16) << "]" << " * ["
<< m_vRPN[i].Val.data << "]" << " + [" << m_vRPN[i].Val.data2 << "]\n";
qDebug() << "VARMUL \t" << "[ADDR: 0x" << QString::number(*m_vRPN.at(i).Val.ptr, 'f', 16) << "]" << " * [" //-V807
<< m_vRPN.at(i).Val.data << "]" << " + [" << m_vRPN.at(i).Val.data2 << "]\n";
break;
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";
break;
case cmFUNC_STR:
qDebug() << "CALL STRFUNC\t" << "[ARG:" << m_vRPN[i].Fun.argc << "]" << "[IDX:" << m_vRPN[i].Fun.idx
<< "]" << "[ADDR: 0x" << m_vRPN[i].Fun.ptr << "]\n";
qDebug() << "CALL STRFUNC\t" << "[ARG:" << m_vRPN.at(i).Fun.argc << "]" << "[IDX:" << m_vRPN.at(i).Fun.idx //-V807
<< "]" << "[ADDR: 0x" << m_vRPN.at(i).Fun.ptr << "]\n";
break;
case cmLT:
qDebug() << "LT\n";
@ -622,15 +622,15 @@ void QmuParserByteCode::AsciiDump()
qDebug() << "POW\n";
break;
case cmIF:
qDebug() << "IF\t" << "[OFFSET:" << m_vRPN[i].Oprt.offset << "]\n";
qDebug() << "IF\t" << "[OFFSET:" << m_vRPN.at(i).Oprt.offset << "]\n";
break;
case cmELSE:
qDebug() << "ELSE\t" << "[OFFSET:" << m_vRPN[i].Oprt.offset << "]\n";
qDebug() << "ELSE\t" << "[OFFSET:" << m_vRPN.at(i).Oprt.offset << "]\n";
break;
case cmENDIF:
qDebug() << "ENDIF\n"; break;
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;
case cmBO:
case cmBC:
@ -644,7 +644,7 @@ void QmuParserByteCode::AsciiDump()
case cmEND:
case cmUNKNOWN:
default:
qDebug() << "(unknown code: " << m_vRPN[i].Cmd << ")\n";
qDebug() << "(unknown code: " << m_vRPN.at(i).Cmd << ")\n";
break;
} // switch cmdCode
} // while bytecode

View File

@ -120,7 +120,7 @@ int QmuParserTester::TestInterface()
iStat += 1; // not supposed to reach this, nonexisting variable "c" deleted...
}
catch ( ... )
{
{ //-V565
// failure is expected...
}
@ -290,7 +290,7 @@ int QmuParserTester::TestNames()
} \
catch (QmuParserError &) \
{ \
iErr = (FAIL==false) ? 0 : 1; \
iErr = static_cast<int>(FAIL); \
} \
iStat += iErr;
@ -1209,7 +1209,7 @@ int QmuParserTester::EqnTestWithVarChange ( const QString &a_str, double a_fVar1
fVal[0] = p.Eval();
// cppcheck-suppress redundantAssignment
var = a_fVar2;
var = a_fVar2; //-V519
fVal[1] = p.Eval();
if ( fabs ( a_fRes1 - fVal[0] ) > 0.0000000001 )

View File

@ -81,30 +81,12 @@ DL_Dxf::DL_Dxf()
*/
DL_Dxf::~DL_Dxf()
{
if (vertices!=nullptr)
{
delete[] vertices;
}
if (knots!=nullptr)
{
delete[] knots;
}
if (controlPoints!=nullptr)
{
delete[] controlPoints;
}
if (fitPoints!=nullptr)
{
delete[] fitPoints;
}
if (weights!=nullptr)
{
delete[] weights;
}
if (leaderVertices!=nullptr)
{
delete[] leaderVertices;
}
}
@ -270,7 +252,7 @@ bool DL_Dxf::getStrippedLine(std::string& s, quint32 size, FILE *fp)
}
else
{
s = "";
s.clear();
return false;
}
}
@ -341,7 +323,7 @@ bool DL_Dxf::stripWhiteSpace(char** s)
++(*s);
}
return ((*s) ? true : false);
return true;
}
@ -616,7 +598,7 @@ bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface,
// }
values.clear();
settingValue[0] = '\0';
settingKey = "";
settingKey.clear();
firstHatchLoop = true;
//firstHatchEdge = true;
hatchEdge = DL_HatchEdgeData();
@ -1617,11 +1599,8 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/)
{
maxVertices = toInt(groupValue);
if (maxVertices>0)
{
if (vertices!=nullptr)
{
delete[] vertices;
}
vertices = new double[4*maxVertices];
for (int i=0; i<maxVertices; ++i)
{
@ -1673,11 +1652,8 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
{
maxKnots = toInt(groupValue);
if (maxKnots>0)
{
if (knots!=nullptr)
{
delete[] knots;
}
knots = new double[maxKnots];
for (int i=0; i<maxKnots; ++i)
{
@ -1693,15 +1669,9 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
{
maxControlPoints = toInt(groupValue);
if (maxControlPoints>0)
{
if (controlPoints!=nullptr)
{
delete[] controlPoints;
}
if (weights!=nullptr)
{
delete[] weights;
}
controlPoints = new double[3*maxControlPoints];
weights = new double[maxControlPoints];
for (int i=0; i<maxControlPoints; ++i)
@ -1722,11 +1692,8 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
{
maxFitPoints = toInt(groupValue);
if (maxFitPoints>0)
{
if (fitPoints!=nullptr)
{
delete[] fitPoints;
}
fitPoints = new double[3*maxFitPoints];
for (int i=0; i<maxFitPoints; ++i)
{
@ -1812,11 +1779,8 @@ bool DL_Dxf::handleLeaderData(DL_CreationInterface* /*creationInterface*/)
{
maxLeaderVertices = toInt(groupValue);
if (maxLeaderVertices>0)
{
if (leaderVertices!=nullptr)
{
delete[] leaderVertices;
}
leaderVertices = new double[3*maxLeaderVertices];
for (int i=0; i<maxLeaderVertices; ++i)
{
@ -4049,7 +4013,7 @@ int DL_Dxf::writeImage(DL_WriterA& dw,
// handle of IMAGEDEF object
int handle = static_cast<int>(dw.incHandle());
dw.dxfHex(340, handle);
dw.dxfHex(340, handle); //-V525
// flags
dw.dxfInt(70, 15);
@ -4087,7 +4051,7 @@ void DL_Dxf::writeImageDef(DL_WriterA& dw,
dw.dxfHex(5, handle);
}
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbRasterImageDef");
dw.dxfInt(90, 0);
@ -4381,7 +4345,7 @@ void DL_Dxf::writeVPort(DL_WriterA& dw) const
dw.dxfHex(5, 0x8);
}
//dw.dxfHex(330, 0);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTable");
}
@ -4393,7 +4357,7 @@ void DL_Dxf::writeVPort(DL_WriterA& dw) const
dw.handle();
}
//dw.dxfHex(330, 8);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbViewportTableRecord");
@ -4484,7 +4448,7 @@ void DL_Dxf::writeStyle(DL_WriterA& dw, const DL_StyleData& style)
}
}
//dw.dxfHex(330, 3);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbTextStyleTableRecord");
@ -4538,7 +4502,7 @@ void DL_Dxf::writeView(DL_WriterA& dw) const
dw.dxfHex(5, 6);
}
//dw.dxfHex(330, 0);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTable");
}
@ -4562,7 +4526,7 @@ void DL_Dxf::writeUcs(DL_WriterA& dw) const
dw.dxfHex(5, 7);
}
//dw.dxfHex(330, 0);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTable");
}
@ -4604,7 +4568,7 @@ void DL_Dxf::writeDimStyle(DL_WriterA& dw,
}
//dw.handle(105);
//dw.dxfHex(330, 0xA);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbDimStyleTableRecord");
@ -4706,7 +4670,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
dw.dxfHex(5, 1);
}
//dw.dxfHex(330, 0);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTable");
}
@ -4720,7 +4684,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
//int msh = dw.handle();
//dw.setModelSpaceHandle(msh);
//dw.dxfHex(330, 1);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbBlockTableRecord");
@ -4736,7 +4700,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
//int psh = dw.handle();
//dw.setPaperSpaceHandle(psh);
//dw.dxfHex(330, 1);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbBlockTableRecord");
@ -4752,7 +4716,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
//int ps0h = dw.handle();
//dw.setPaperSpace0Handle(ps0h);
//dw.dxfHex(330, 1);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbBlockTableRecord");
@ -4776,7 +4740,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) const
dw.handle();
}
//dw->dxfHex(330, 1);
if (version==DL_VERSION_2000)
if (version==DL_VERSION_2000) //-V581
{
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbBlockTableRecord");
@ -5235,10 +5199,6 @@ bool DL_Dxf::checkVariable(const char* var, DL_Codes::version version)
{
return true;
}
if (!strcmp(var, "$ACADVER"))
{
return true;
}
if (!strcmp(var, "$ANGBASE"))
{
return true;

View File

@ -347,7 +347,7 @@ void DL_Writer::entityAttributes(const DL_Attributes &attrib) const
{
dxfInt(370, attrib.getWidth());
}
if (version>=DL_VERSION_2000)
if (version>=DL_VERSION_2000) //-V581
{
dxfReal(48, attrib.getLinetypeScale());
}

View File

@ -72,7 +72,7 @@ void DL_WriterA::dxfReal(int gc, double value) const
// Cut away those zeros at the end:
bool dot = false;
int end = -1;
for (quint32 i=0; i<strlen(str); ++i)
for (quint32 i=0, sz = strlen(str); i<sz; ++i)
{
if (str[i]=='.')
{

View File

@ -296,7 +296,8 @@ void VDxfEngine::drawTextItem(const QPointF & p, const QTextItem & textItem)
QPointF startPoint = matrix.map(p);
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(
*dw,
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, // Vertical justification (0 = Baseline (default), 1 = Bottom, 2 = Middle, 3= Top)
textItem.text().toUtf8().constData(), // text data
textItem.font().family().toUtf8().constData(), // font
f.family().toUtf8().constData(), // font
-rotationAngle
),
DL_Attributes("0", getPenColor(), state->pen().width(), getPenStyle(), 1.0));
@ -341,7 +342,7 @@ QSize VDxfEngine::getSize() const
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::setSize(const QSize &value)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
size = value;
}
@ -354,7 +355,7 @@ int VDxfEngine::getResolution() const
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::setResolution(int value)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
resolution = value;
}
@ -367,7 +368,7 @@ QString VDxfEngine::getFileName() const
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::setFileName(const QString &value)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
fileName = value;
}
@ -471,13 +472,13 @@ int VDxfEngine::getPenColor()
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::setMeasurement(const VarMeasurement &var)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
varMeasurement = var;
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::setInsunits(const VarInsunits &var)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
varInsunits = var;
}

View File

@ -195,7 +195,7 @@ QVector<QPointF> VArc::GetPoints() const
qreal i = 0;
const qreal angle = AngleArc();
const qint32 k = static_cast<qint32>(angle);
const qreal s = angle/(k/4);
const qreal s = angle/(k/4); //-V636
do
{
QPointF pStart;

View File

@ -472,7 +472,7 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
{
const int dx1 = p2.toPoint().x() - p1.toPoint().x();
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;
}

View File

@ -58,7 +58,7 @@ public:
qreal L = 0, radius = 0, angle = 90;
QPointF point1 = this->p1.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 );
QLineF p1p2(this->p1.x(), this->p1.y(), this->p1.x() + L * kAsm1, this->p1.y());
p1p2.setAngle(angle1);
@ -77,7 +77,7 @@ public:
qreal L = 0, radius = 0, angle = 90;
QPointF point1 = this->p1.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 );
this->kCurve = kCurve;

View File

@ -53,7 +53,7 @@ VSplinePath::~VSplinePath()
//---------------------------------------------------------------------------------------------------------------------
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;
}
@ -92,8 +92,9 @@ VSpline VSplinePath::GetSpline(qint32 index) const
{
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(),
d->path.at(index).Angle1(), d->path.at(index-1).KAsm2(), d->path.at(index).KAsm1(), d->kCurve);
const VSplinePoint &p1 = d->path.at(index-1);
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;
}
@ -103,8 +104,9 @@ QPainterPath VSplinePath::GetPath(PathDirection direction) const
QPainterPath painterPath;
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(),
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
const VSplinePoint &p1 = d->path.at(i-1);
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));
}
return painterPath;
@ -116,8 +118,9 @@ QVector<QPointF> VSplinePath::GetPoints() const
QVector<QPointF> pathPoints;
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(),
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
const VSplinePoint &p1 = d->path.at(i-1);
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();
}
return pathPoints;
@ -129,8 +132,10 @@ qreal VSplinePath::GetLength() const
qreal length = 0;
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(),
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
const VSplinePoint &p1 = d->path.at(i-1);
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();
}
return length;
@ -217,8 +222,10 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
fullLength = 0;
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(),
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
const VSplinePoint &point1 = d->path.at(i-1);
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();
if (fullLength > length)
{
@ -236,8 +243,9 @@ int VSplinePath::Segment(const QPointF &p) const
int index = -1;
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(),
d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve);
const VSplinePoint &p1 = d->path.at(i-1);
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);

View File

@ -127,7 +127,7 @@ QSizeF VContour::GetSize() const
QVector<QPointF> VContour::UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const
{
QVector<QPointF> newContour;
if (d->globalContour.isEmpty())
if (d->globalContour.isEmpty()) //-V807
{
AppendWhole(newContour, detail, detJ);
}
@ -233,7 +233,7 @@ int VContour::EdgesCount() 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.
const QLineF axis = EmptySheetEdge();

View File

@ -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 qreal angle = edge.angleTo(axis);
const QPointF p2 = edge.p2();
QTransform m;
m.translate(edge.p2().x(), edge.p2().y());
m.translate(p2.x(), p2.y());
m.rotate(-angle);
m.translate(-edge.p2().x(), -edge.p2().y());
m.translate(-p2.x(), -p2.y());
d->matrix *= m;
m.reset();
m.translate(edge.p2().x(), edge.p2().y());
m.translate(p2.x(), p2.y());
m.scale(m.m11(), m.m22()*-1);
m.translate(-edge.p2().x(), -edge.p2().y());
m.translate(-p2.x(), -p2.y());
d->matrix *= m;
m.reset();
m.translate(edge.p2().x(), edge.p2().y());
m.translate(p2.x(), p2.y());
m.rotate(-(360-angle));
m.translate(-edge.p2().x(), -edge.p2().y());
m.translate(-p2.x(), -p2.y());
d->matrix *= m;
d->mirror = !d->mirror;
@ -214,8 +215,9 @@ QLineF VLayoutDetail::Edge(int i) const
if (d->mirror)
{
const int oldI1 = i1;
i1 = (d->layoutAllowence.size()-1) - i2;
i2 = (d->layoutAllowence.size()-1) - oldI1;
const int size = d->layoutAllowence.size()-1; //-V807
i1 = size - i2;
i2 = size - oldI1;
return QLineF(d->matrix.map(d->layoutAllowence.at(i2)), d->matrix.map(d->layoutAllowence.at(i1)));
}
else
@ -280,7 +282,7 @@ bool VLayoutDetail::isNull() const
//---------------------------------------------------------------------------------------------------------------------
qint64 VLayoutDetail::Square() const
{
if (d->layoutAllowence.isEmpty())
if (d->layoutAllowence.isEmpty()) //-V807
{
return 0;
}

View File

@ -288,7 +288,7 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop) const
}
const int height = scene->itemsBoundingRect().toRect().height() + static_cast<int>(d->layoutWidth)*2;
delete scene;
if (d->globalContour.GetHeight() > height)
if (d->globalContour.GetHeight() > height) //-V807
{
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height));
}

View File

@ -497,8 +497,8 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
for (int i=0; i<polyCorners; i++)
{
const qreal xi = gContour.at(i).x();
const qreal xj = gContour.at(j).x();
const qreal xi = gContour.at(i).x(); //-V807
const qreal xj = gContour.at(j).x(); //-V807
const qreal yi = gContour.at(i).y();
const qreal yj = gContour.at(j).y();
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 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;

View File

@ -109,7 +109,7 @@ int VPoster::CountRows(int height) const
// Calculate how many pages will be after using allowence.
// We know start pages count. This number not enought because
// 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).
// 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.
// We know start pages count. This number not enought because
// 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).
// 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);
painter.setPen(pen);
const QRect rec = image.rect();
if (j != 0 && PageRect().x() > 0)
{// Left border
painter.drawLine(QLine(0, 0, 0, image.rect().height()));
painter.drawImage(QPoint(0, image.rect().height()-static_cast<int>(allowence)),
painter.drawLine(QLine(0, 0, 0, rec.height()));
painter.drawImage(QPoint(0, rec.height()-static_cast<int>(allowence)),
QImage("://scissors_vertical.png"));
}
if (j != colomns-1)
{// Right border
painter.drawLine(QLine(image.rect().width()-static_cast<int>(allowence), 0,
image.rect().width()-static_cast<int>(allowence), image.rect().height()));
painter.drawLine(QLine(rec.width()-static_cast<int>(allowence), 0,
rec.width()-static_cast<int>(allowence), rec.height()));
}
if (i != 0 && PageRect().y() > 0)
{// Top border
painter.drawLine(QLine(0, 0, image.rect().width(), 0));
painter.drawImage(QPoint(image.rect().width()-static_cast<int>(allowence), 0),
painter.drawLine(QLine(0, 0, rec.width(), 0));
painter.drawImage(QPoint(rec.width()-static_cast<int>(allowence), 0),
QImage("://scissors_horizontal.png"));
}
if (rows*colomns > 1)
{ // Don't show bottom border if only one page need
// Bottom border (mandatory)
painter.drawLine(QLine(0, image.rect().height()-static_cast<int>(allowence),
image.rect().width(), image.rect().height()-static_cast<int>(allowence)));
painter.drawLine(QLine(0, rec.height()-static_cast<int>(allowence),
rec.width(), rec.height()-static_cast<int>(allowence)));
if (i == rows-1)
{
painter.drawImage(QPoint(image.rect().width()-static_cast<int>(allowence),
image.rect().height()-static_cast<int>(allowence)),
painter.drawImage(QPoint(rec.width()-static_cast<int>(allowence),
rec.height()-static_cast<int>(allowence)),
QImage("://scissors_horizontal.png"));
}
}
@ -226,8 +227,8 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
// Labels
const int layoutX = 15;
const int layoutY = 5;
QRect labels(layoutX, image.rect().height()-static_cast<int>(allowence)+layoutY,
image.rect().width()-(static_cast<int>(allowence)+layoutX), static_cast<int>(allowence)-layoutY);
QRect labels(layoutX, rec.height()-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::AlignHCenter, tr("Page %1 of %2").arg(i*(colomns)+j+1).arg(rows*colomns));
if (sheets > 1)

View File

@ -59,9 +59,8 @@ QString compilerString()
{
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
}
#else
return QLatin1String("<unknown compiler>");
#endif
return QLatin1String("<unknown compiler>");
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -37,6 +37,10 @@
# include <QtMath>
#endif
#ifdef Q_CC_MSVC
#include <ciso646>
#endif /* Q_CC_MSVC */
//---------------------------------------------------------------------------------------------------------------------
static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
{
@ -278,7 +282,7 @@ QSize VObjEngine::getSize() const
//---------------------------------------------------------------------------------------------------------------------
void VObjEngine::setSize(const QSize &value)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
size = value;
}
@ -291,7 +295,7 @@ QIODevice *VObjEngine::getOutputDevice() const
//---------------------------------------------------------------------------------------------------------------------
void VObjEngine::setOutputDevice(QIODevice *value)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
outputDevice.reset(value);
}
@ -304,7 +308,7 @@ int VObjEngine::getResolution() const
//---------------------------------------------------------------------------------------------------------------------
void VObjEngine::setResolution(int value)
{
Q_ASSERT(!isActive());
Q_ASSERT(not isActive());
resolution = value;
}

View File

@ -35,7 +35,7 @@
VObjPaintDevice::VObjPaintDevice()
: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();
}
owns_iodevice = true;
owns_iodevice = static_cast<int>(true);
fileName = value;
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");
return;
}
owns_iodevice = false;
owns_iodevice = static_cast<int>(false);
engine->setOutputDevice(outputDevice);
fileName = QString();
}

View File

@ -177,7 +177,7 @@ quint32 VContainer::AddGObject(VGObject *obj)
* @param detail new detail
* @return return id of new detail in container
*/
quint32 VContainer::AddDetail(VDetail detail)
quint32 VContainer::AddDetail(const VDetail &detail)
{
quint32 id = getNextId();
d->details[id] = detail;
@ -224,7 +224,7 @@ void VContainer::UpdateId(quint32 newId)
template <typename val>
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);
point->setId(id);
if (d->gObjects.contains(id))
@ -276,7 +276,7 @@ void VContainer::ClearForFullParse()
void VContainer::ClearGObjects()
{
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();
}
@ -286,7 +286,7 @@ void VContainer::ClearGObjects()
//---------------------------------------------------------------------------------------------------------------------
void VContainer::ClearCalculationGObjects()
{
if (not d->gObjects.isEmpty())
if (not d->gObjects.isEmpty()) //-V807
{
QVector<quint32> keys;
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
@ -312,7 +312,7 @@ void VContainer::ClearCalculationGObjects()
//---------------------------------------------------------------------------------------------------------------------
void VContainer::ClearVariables(const VarType &type)
{
if (d->variables.size()>0)
if (d->variables.size()>0) //-V807
{
if (type == VarType::Unknown)
{
@ -421,7 +421,7 @@ void VContainer::UpdateGObject(quint32 id, VGObject* obj)
*/
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;
UpdateId(id);
}

View File

@ -49,7 +49,7 @@
#pragma GCC diagnostic ignored "-Weffc++"
#endif
class VContainerData : public QSharedData
class VContainerData : public QSharedData //-V690
{
public:
@ -117,7 +117,7 @@ public:
static void UpdateId(quint32 newId);
quint32 AddGObject(VGObject *obj);
quint32 AddDetail(VDetail detail);
quint32 AddDetail(const VDetail &detail);
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
void AddArc(const quint32 &arcId, const quint32 &parentId = 0);

View File

@ -329,7 +329,7 @@ VDetail VDetail::RemoveEdge(const quint32 &index) 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>();
}
@ -483,7 +483,7 @@ QPainterPath VDetail::ContourPath(const VContainer *data) const
QVector<VNodeDetail> VDetail::listNodePoint() const
{
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)
{

View File

@ -498,11 +498,12 @@ bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin();
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;
newToken.replace(0, i.value().translate().length(), i.key());
newToken.replace(0, var.translate().length(), i.key());
bias = token.length() - newToken.length();
return true;
}

View File

@ -27,7 +27,7 @@
namespace VPE
{
struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D
struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D //-V690
{
public:
Vector3D()

View File

@ -114,7 +114,7 @@ void VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int en
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
Q_UNUSED(parent)

View File

@ -423,7 +423,7 @@ void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, co
* @param var container with variables
*/
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->clear();

View File

@ -97,7 +97,7 @@ private:
void InitVariables();
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);
};

View File

@ -256,8 +256,9 @@ void DialogDetail::setDetail(const VDetail &value)
ui.listWidget->clear();
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(),
detail.at(i).getMy(), detail.at(i).getReverse());
const VNodeDetail &node = detail.at(i);
NewItem(node.getId(), node.getTypeTool(), node.getTypeNode(), node.getMx(),
node.getMy(), node.getReverse());
}
ui.lineEditNameDetail->setText(detail.getName());
ui.checkBoxSeams->setChecked(detail.getSeamAllowance());

View File

@ -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));
if (index != -1)

View File

@ -54,7 +54,7 @@ public:
void SetTangentPointId(const quint32 &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &p);
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;

View File

@ -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));
if (index != -1)

View File

@ -56,7 +56,7 @@ public:
void SetTangentPointId(const quint32 &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &p);
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;

View File

@ -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));
if (index != -1)

View File

@ -53,7 +53,7 @@ public:
void SetSecondArcId(const quint32 &value);
CrossCirclesPoint GetCrossArcPoint() const;
void SetCrossArcPoint(CrossCirclesPoint &p);
void SetCrossArcPoint(const CrossCirclesPoint &p);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;

View File

@ -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));
if (index != -1)

View File

@ -59,7 +59,7 @@ public:
void SetSecondCircleRadius(const QString &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &p);
void SetCrossCirclesPoint(const CrossCirclesPoint &p);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;

View File

@ -84,7 +84,8 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
ui->listWidget->clear();
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->doubleSpinBoxKcurve->setValue(path.GetKCurve());

View File

@ -684,7 +684,7 @@ void DialogTool::FormulaChanged()
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FormulaChangedPlainText()
void DialogTool::FormulaChangedPlainText() //-V524
{
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
if (edit)

View File

@ -100,8 +100,8 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstr
QString f1 = dialogTool->GetF1();
QString f2 = dialogTool->GetF2();
const QString color = dialogTool->GetColor();
VToolArc* point = nullptr;
point=Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse, Source::FromGui);
VToolArc* point = Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -344,12 +344,13 @@ void VToolArc::SetVisualization()
{
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
SCASSERT(visual != nullptr)
SCASSERT(visual != nullptr);
const VTranslateVars *trVars = qApp->TrVars();
visual->setPoint1Id(arc->GetCenter().id());
visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1()));
visual->setF2(qApp->TrVars()->FormulaToUser(arc->GetFormulaF2()));
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2()));
visual->RefreshGeometry();
}
}

View File

@ -82,8 +82,8 @@ VToolArcWithLength *VToolArcWithLength::Create(DialogTool *dialog, VMainGraphics
QString f1 = dialogTool->GetF1();
QString length = dialogTool->GetLength();
const QString color = dialogTool->GetColor();
VToolArcWithLength* point = nullptr;
point=Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse, Source::FromGui);
VToolArcWithLength* point = Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -300,12 +300,13 @@ void VToolArcWithLength::SetVisualization()
{
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
VisToolArcWithLength *visual = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(visual != nullptr)
SCASSERT(visual != nullptr);
const VTranslateVars *trVars = qApp->TrVars();
visual->setPoint1Id(arc->GetCenter().id());
visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1()));
visual->setLength(qApp->TrVars()->FormulaToUser(arc->GetFormulaLength()));
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength()));
visual->RefreshGeometry();
}
}

View File

@ -139,9 +139,8 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
const qreal angle2 = dialogTool->GetAngle2();
const qreal kCurve = dialogTool->GetKCurve();
const QString color = dialogTool->GetColor();
VToolSpline *spl = nullptr;
spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data, Document::FullParse,
Source::FromGui);
VToolSpline *spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data,
Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;

View File

@ -132,8 +132,7 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
{
doc->IncrementReferens((*path)[i].P().id());
}
VToolSplinePath* spl = nullptr;
spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
VToolSplinePath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;

View File

@ -120,9 +120,9 @@ VToolTrueDarts *VToolTrueDarts::Create(DialogTool *dialog, VMainGraphicsScene *s
const quint32 dartP2Id = dialogTool->GetSecondDartPointId();
const quint32 dartP3Id = dialogTool->GetThirdDartPointId();
VToolTrueDarts *point = nullptr;
point=Create(0, 0, 0, baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id, point1Name, 5, 10, point2Name, 5,
10, scene, doc, data, Document::FullParse, Source::FromGui);
VToolTrueDarts *point = Create(0, 0, 0, baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id,
point1Name, 5, 10, point2Name, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog = dialogTool;

View File

@ -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),
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id), detailsMode(false)
{
Q_ASSERT_X(curveCutId > 0, Q_FUNC_INFO, "curveCutId <= 0");
Q_ASSERT_X(curve1id > 0, Q_FUNC_INFO, "curve1id <= 0");
Q_ASSERT_X(curve2id > 0, Q_FUNC_INFO, "curve2id <= 0");
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
Q_ASSERT_X(curve1id != 0, Q_FUNC_INFO, "curve1id == 0"); //-V654 //-V712
Q_ASSERT_X(curve2id != 0, Q_FUNC_INFO, "curve2id == 0"); //-V654 //-V712
lineColor = color;
@ -159,7 +159,7 @@ void VToolCut::RemoveReferens()
// cppcheck-suppress unusedFunction
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);
if (domElement.isElement())

View File

@ -94,8 +94,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
QString formula = dialogTool->GetFormula();
const quint32 arcId = dialogTool->getArcId();
const QString color = dialogTool->GetColor();
VToolCutArc* point = nullptr;
point=Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, Source::FromGui);
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -94,8 +94,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
QString formula = dialogTool->GetFormula();
const quint32 splineId = dialogTool->getSplineId();
const QString color = dialogTool->GetColor();
VToolCutSpline* point = nullptr;
point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{

View File

@ -97,8 +97,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
QString formula = dialogTool->GetFormula();
const quint32 splinePathId = dialogTool->getSplinePathId();
const QString color = dialogTool->GetColor();
VToolCutSplinePath* point = nullptr;
point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{

View File

@ -205,9 +205,8 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolAlongLine *point=nullptr;
point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolAlongLine *point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId,
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -137,9 +137,8 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolBisector *point = nullptr;
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor, pointName, 5, 10, scene,
doc, data, Document::FullParse, Source::FromGui);
VToolBisector *point = Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor,
pointName, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -84,9 +84,9 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
const quint32 basePointId = dialogTool->GetBasePointId();
const quint32 curveId = dialogTool->getCurveId();
VToolCurveIntersectAxis *point = nullptr;
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolCurveIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId,
curveId, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -104,9 +104,8 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
QString formulaAngle = dialogTool->GetAngle();
const quint32 basePointId = dialogTool->GetBasePointId();
VToolEndLine *point = nullptr;
point=Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolEndLine *point = Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle,
basePointId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -94,9 +94,8 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
const quint32 p1LineId = dialogTool->GetP1LineId();
const quint32 p2LineId = dialogTool->GetP2LineId();
VToolHeight *point = nullptr;
point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolHeight *point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -86,8 +86,8 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
VToolLineIntersectAxis *point = nullptr;
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10,
VToolLineIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle,
basePointId, firstPointId, secondPointId, 5, 10,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{

View File

@ -50,7 +50,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
{
this->typeLine = typeLine;
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 point2 = data->GeometricObject<VPointF>(id)->toQPointF();
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);

View File

@ -98,9 +98,8 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
const qreal angle = dialogTool->GetAngle();
VToolNormal *point = nullptr;
point=Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
VToolNormal *point = Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -138,9 +138,8 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolShoulderPoint * point = nullptr;
point=Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolShoulderPoint * point = Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5,
10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -92,7 +92,7 @@ void VToolBasePoint::ShowVisualization(bool show)
*/
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);

View File

@ -93,9 +93,8 @@ VToolLineIntersect* VToolLineIntersect::Create(DialogTool *dialog, VMainGraphics
const quint32 p1Line2Id = dialogTool->GetP1Line2();
const quint32 p2Line2Id = dialogTool->GetP2Line2();
const QString pointName = dialogTool->getPointName();
VToolLineIntersect* point = nullptr;
point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolLineIntersect* point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -68,9 +68,8 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(DialogTool *dia
const quint32 tangentPointId = dialogTool->GetTangentPointId();
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
const QString pointName = dialogTool->getPointName();
VToolPointFromArcAndTangent *point = nullptr;
point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
VToolPointFromArcAndTangent *point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -244,7 +243,7 @@ CrossCirclesPoint VToolPointFromArcAndTangent::GetCrossCirclesPoint() const
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value)
void VToolPointFromArcAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &value)
{
crossPoint = value;

View File

@ -57,7 +57,7 @@ public:
void SetArcId(const quint32 &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &value);
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:

View File

@ -73,9 +73,8 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(DialogToo
const quint32 tangentPointId = dialogTool->GetTangentPointId();
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
const QString pointName = dialogTool->getPointName();
VToolPointFromCircleAndTangent *point = nullptr;
point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolPointFromCircleAndTangent *point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType,
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -228,7 +227,7 @@ CrossCirclesPoint VToolPointFromCircleAndTangent::GetCrossCirclesPoint() const
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value)
void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &value)
{
crossPoint = value;

View File

@ -63,7 +63,7 @@ public:
void SetCircleRadius(const VFormula &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &value);
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:

View File

@ -155,9 +155,8 @@ VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphi
const quint32 firstPointId = dialogTool->GetFirstPoint();
const quint32 secondPointId = dialogTool->GetSecondPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfContact *point = nullptr;
point=Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolPointOfContact *point = Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -86,9 +86,8 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(DialogTool *dialog, V
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersection *point = nullptr;
point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
VToolPointOfIntersection *point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -68,9 +68,8 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *d
const quint32 secondArcId = dialogTool->GetSecondArcId();
const CrossCirclesPoint pType = dialogTool->GetCrossArcPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersectionArcs *point = nullptr;
point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
VToolPointOfIntersectionArcs *point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
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 p1, p2;
const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(),
arc2->GetCenter().toQPointF(), arc2->GetRadius(), p1, p2);
const QPointF centerArc1 = arc1->GetCenter().toQPointF();
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);
QLineF r1Arc2(arc2->GetCenter().toQPointF(), p1);
QLineF r1Arc2(centerArc2, p1);
r1Arc2.setLength(r1Arc2.length()+10);
QLineF r2Arc1(arc1->GetCenter().toQPointF(), p2);
QLineF r2Arc1(centerArc1, p2);
r2Arc1.setLength(r2Arc1.length()+10);
QLineF r2Arc2(arc2->GetCenter().toQPointF(), p2);
QLineF r2Arc2(centerArc2, p2);
r2Arc2.setLength(r2Arc2.length()+10);
switch(res)
@ -250,7 +250,7 @@ CrossCirclesPoint VToolPointOfIntersectionArcs::GetCrossCirclesPoint() const
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SetCrossCirclesPoint(CrossCirclesPoint &value)
void VToolPointOfIntersectionArcs::SetCrossCirclesPoint(const CrossCirclesPoint &value)
{
crossPoint = value;

View File

@ -61,7 +61,7 @@ public:
void SetSecondArcId(const quint32 &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &value);
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:

View File

@ -79,9 +79,9 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(DialogT
QString secondCircleRadius = dialogTool->GetSecondCircleRadius();
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersectionCircles *point = nullptr;
point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId, firstCircleRadius, secondCircleRadius,
pType, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
VToolPointOfIntersectionCircles *point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId,
firstCircleRadius, secondCircleRadius, pType, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -263,7 +263,7 @@ CrossCirclesPoint VToolPointOfIntersectionCircles::GetCrossCirclesPoint() const
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::SetCrossCirclesPoint(CrossCirclesPoint &value)
void VToolPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPoint &value)
{
crossPoint = value;

View File

@ -72,7 +72,7 @@ public:
void SetSecondCircleRadius(const VFormula &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(CrossCirclesPoint &value);
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:

View File

@ -93,9 +93,8 @@ VToolTriangle* VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *sce
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString pointName = dialogTool->getPointName();
VToolTriangle* point = nullptr;
point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
VToolTriangle* point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;

View File

@ -128,8 +128,7 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, b
QMenu menu;
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
QAction *actionRemove = nullptr;
actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
if (showRemove)
{
if (_referens > 1)

View File

@ -101,8 +101,7 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbs
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
VToolLine *line = nullptr;
line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse,
VToolLine *line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse,
Source::FromGui);
if (line != nullptr)
{

View File

@ -46,23 +46,6 @@ VDataTool::VDataTool(VContainer *data, QObject *parent)
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.

View File

@ -46,7 +46,6 @@ class VDataTool : public QObject
public:
explicit VDataTool(VContainer *data, QObject *parent = nullptr);
virtual ~VDataTool() Q_DECL_OVERRIDE;
VDataTool &operator= (const VDataTool &tool);
VContainer getData() const;
void setData(const VContainer *value);
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. */
quint32 _referens;
private:
Q_DISABLE_COPY(VDataTool)
};
//---------------------------------------------------------------------------------------------------------------------

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