"static" members should be accessed statically.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-03-23 10:25:46 +02:00
parent 5ca119bb5b
commit d696af9a33
66 changed files with 162 additions and 158 deletions

View File

@ -167,8 +167,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
{ {
//fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will //fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will
//lead to crash //lead to crash
const bool topWinAllowsPop = (qApp->activeModalWidget() == nullptr) || const bool topWinAllowsPop = (QApplication::activeModalWidget() == nullptr) ||
!qApp->activeModalWidget()->inherits("QFileDialog"); !QApplication::activeModalWidget()->inherits("QFileDialog");
QMessageBox messageBox; QMessageBox messageBox;
switch (type) switch (type)
{ {
@ -390,8 +390,8 @@ void MApplication::InitOptions()
qCDebug(mApp, "Build revision: %s", BUILD_REVISION); qCDebug(mApp, "Build revision: %s", BUILD_REVISION);
qCDebug(mApp, "%s", qUtf8Printable(buildCompatibilityString())); qCDebug(mApp, "%s", qUtf8Printable(buildCompatibilityString()));
qCDebug(mApp, "Built on %s at %s", __DATE__, __TIME__); qCDebug(mApp, "Built on %s at %s", __DATE__, __TIME__);
qCDebug(mApp, "Command-line arguments: %s", qUtf8Printable(this->arguments().join(", "))); qCDebug(mApp, "Command-line arguments: %s", qUtf8Printable(arguments().join(", ")));
qCDebug(mApp, "Process ID: %s", qUtf8Printable(QString().setNum(this->applicationPid()))); qCDebug(mApp, "Process ID: %s", qUtf8Printable(QString().setNum(applicationPid())));
LoadTranslation(QLocale().name());// By default the console version uses system locale LoadTranslation(QLocale().name());// By default the console version uses system locale

View File

@ -186,7 +186,7 @@ void TMainWindow::SetBaseMHeight(int height)
if (mType == MeasurementsType::Standard) if (mType == MeasurementsType::Standard)
{ {
const int row = ui->tableWidget->currentRow(); const int row = ui->tableWidget->currentRow();
data->SetHeight(UnitConvertor(height, Unit::Cm, mUnit)); VContainer::SetHeight(UnitConvertor(height, Unit::Cm, mUnit));
RefreshData(); RefreshData();
ui->tableWidget->selectRow(row); ui->tableWidget->selectRow(row);
} }
@ -201,7 +201,7 @@ void TMainWindow::SetBaseMSize(int size)
if (mType == MeasurementsType::Standard) if (mType == MeasurementsType::Standard)
{ {
const int row = ui->tableWidget->currentRow(); const int row = ui->tableWidget->currentRow();
data->SetSize(UnitConvertor(size, Unit::Cm, mUnit)); VContainer::SetSize(UnitConvertor(size, Unit::Cm, mUnit));
RefreshData(); RefreshData();
ui->tableWidget->selectRow(row); ui->tableWidget->selectRow(row);
} }
@ -287,8 +287,8 @@ bool TMainWindow::LoadFile(const QString &path)
mUnit = m->MUnit(); mUnit = m->MUnit();
pUnit = mUnit; pUnit = mUnit;
data->SetHeight(m->BaseHeight()); VContainer::SetHeight(m->BaseHeight());
data->SetSize(m->BaseSize()); VContainer::SetSize(m->BaseSize());
ui->labelToolTip->setVisible(false); ui->labelToolTip->setVisible(false);
ui->tabWidget->setVisible(true); ui->tabWidget->setVisible(true);
@ -353,8 +353,8 @@ void TMainWindow::FileNew()
mType = measurements.Type(); mType = measurements.Type();
data = new VContainer(qApp->TrVars(), &mUnit); data = new VContainer(qApp->TrVars(), &mUnit);
data->SetHeight(measurements.BaseHeight()); VContainer::SetHeight(measurements.BaseHeight());
data->SetSize(measurements.BaseSize()); VContainer::SetSize(measurements.BaseSize());
if (mType == MeasurementsType::Standard) if (mType == MeasurementsType::Standard)
{ {
@ -1401,7 +1401,7 @@ void TMainWindow::ImportFromPattern()
void TMainWindow::ChangedSize(const QString &text) void TMainWindow::ChangedSize(const QString &text)
{ {
const int row = ui->tableWidget->currentRow(); const int row = ui->tableWidget->currentRow();
data->SetSize(text.toInt()); VContainer::SetSize(text.toInt());
RefreshData(); RefreshData();
search->RefreshList(ui->lineEditFind->text()); search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->selectRow(row); ui->tableWidget->selectRow(row);
@ -1411,7 +1411,7 @@ void TMainWindow::ChangedSize(const QString &text)
void TMainWindow::ChangedHeight(const QString &text) void TMainWindow::ChangedHeight(const QString &text)
{ {
const int row = ui->tableWidget->currentRow(); const int row = ui->tableWidget->currentRow();
data->SetHeight(text.toInt()); VContainer::SetHeight(text.toInt());
RefreshData(); RefreshData();
search->RefreshList(ui->lineEditFind->text()); search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->selectRow(row); ui->tableWidget->selectRow(row);
@ -1997,13 +1997,13 @@ void TMainWindow::InitWindow()
labelGradationHeights = new QLabel(tr("Height:")); labelGradationHeights = new QLabel(tr("Height:"));
gradationHeights = SetGradationList(labelGradationHeights, listHeights); gradationHeights = SetGradationList(labelGradationHeights, listHeights);
SetDefaultHeight(static_cast<int>(data->height())); SetDefaultHeight(static_cast<int>(VContainer::height()));
connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &TMainWindow::ChangedHeight); this, &TMainWindow::ChangedHeight);
labelGradationSizes = new QLabel(tr("Size:")); labelGradationSizes = new QLabel(tr("Size:"));
gradationSizes = SetGradationList(labelGradationSizes, listSizes); gradationSizes = SetGradationList(labelGradationSizes, listSizes);
SetDefaultSize(static_cast<int>(data->size())); SetDefaultSize(static_cast<int>(VContainer::size()));
connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &TMainWindow::ChangedSize); this, &TMainWindow::ChangedSize);
@ -2319,7 +2319,7 @@ void TMainWindow::SetDefaultHeight(int value)
} }
else else
{ {
data->SetHeight(gradationHeights->currentText().toInt()); VContainer::SetHeight(gradationHeights->currentText().toInt());
} }
} }
@ -2333,14 +2333,14 @@ void TMainWindow::SetDefaultSize(int value)
} }
else else
{ {
data->SetSize(gradationSizes->currentText().toInt()); VContainer::SetSize(gradationSizes->currentText().toInt());
} }
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::RefreshData() void TMainWindow::RefreshData()
{ {
data->ClearUniqueNames(); VContainer::ClearUniqueNames();
data->ClearVariables(VarType::Measurement); data->ClearVariables(VarType::Measurement);
m->ReadMeasurements(); m->ReadMeasurements();
@ -2812,8 +2812,8 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
mUnit = m->MUnit(); mUnit = m->MUnit();
pUnit = mUnit; pUnit = mUnit;
data->SetHeight(m->BaseHeight()); VContainer::SetHeight(m->BaseHeight());
data->SetSize(m->BaseSize()); VContainer::SetSize(m->BaseSize());
ui->labelToolTip->setVisible(false); ui->labelToolTip->setVisible(false);
ui->tabWidget->setVisible(true); ui->tabWidget->setVisible(true);

View File

@ -178,8 +178,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
{ {
//fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will //fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will
//lead to crash //lead to crash
const bool topWinAllowsPop = (qApp->activeModalWidget() == nullptr) || const bool topWinAllowsPop = (QApplication::activeModalWidget() == nullptr) ||
!qApp->activeModalWidget()->inherits("QFileDialog"); !QApplication::activeModalWidget()->inherits("QFileDialog");
QMessageBox messageBox; QMessageBox messageBox;
switch (type) switch (type)
@ -298,9 +298,10 @@ void VApplication::NewValentina(const QString &fileName)
qCDebug(vApp, "Open new detached process."); qCDebug(vApp, "Open new detached process.");
if (fileName.isEmpty()) if (fileName.isEmpty())
{ {
qCDebug(vApp, "New process without arguments. program = %s", qUtf8Printable(qApp->applicationFilePath())); qCDebug(vApp, "New process without arguments. program = %s",
qUtf8Printable(QCoreApplication::applicationFilePath()));
// Path can contain spaces. // Path can contain spaces.
if (QProcess::startDetached("\""+qApp->applicationFilePath()+"\"")) if (QProcess::startDetached("\""+QCoreApplication::applicationFilePath()+"\""))
{ {
qCDebug(vApp, "The process was started successfully."); qCDebug(vApp, "The process was started successfully.");
} }
@ -311,7 +312,7 @@ void VApplication::NewValentina(const QString &fileName)
} }
else else
{ {
const QString run = QString("\"%1\" \"%2\"").arg(qApp->applicationFilePath()).arg(fileName); const QString run = QString("\"%1\" \"%2\"").arg(QCoreApplication::applicationFilePath()).arg(fileName);
qCDebug(vApp, "New process with arguments. program = %s", qUtf8Printable(run)); qCDebug(vApp, "New process with arguments. program = %s", qUtf8Printable(run));
if (QProcess::startDetached(run)) if (QProcess::startDetached(run))
{ {
@ -466,7 +467,7 @@ QString VApplication::LogDirPath() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VApplication::LogPath() const QString VApplication::LogPath() const
{ {
return QString("%1/valentina-pid%2.log").arg(LogDirPath()).arg(qApp->applicationPid()); return QString("%1/valentina-pid%2.log").arg(LogDirPath()).arg(applicationPid());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -562,8 +563,8 @@ void VApplication::InitOptions()
qDebug()<<"Build revision:"<<BUILD_REVISION; qDebug()<<"Build revision:"<<BUILD_REVISION;
qDebug()<<buildCompatibilityString(); qDebug()<<buildCompatibilityString();
qDebug()<<"Built on"<<__DATE__<<"at"<<__TIME__; qDebug()<<"Built on"<<__DATE__<<"at"<<__TIME__;
qDebug()<<"Command-line arguments:"<<this->arguments(); qDebug()<<"Command-line arguments:"<<arguments();
qDebug()<<"Process ID:"<<this->applicationPid(); qDebug()<<"Process ID:"<<applicationPid();
if (VApplication::IsGUIMode())// By default console version uses system locale if (VApplication::IsGUIMode())// By default console version uses system locale
{ {

View File

@ -632,7 +632,7 @@ void DialogPatternProperties::SetDefaultHeight(const QString &def)
} }
else else
{ {
const int height = static_cast<int>(pattern->height()); const int height = static_cast<int>(VContainer::height());
index = ui->comboBoxHeight->findText(QString().setNum(height)); index = ui->comboBoxHeight->findText(QString().setNum(height));
if (index != -1) if (index != -1)
{ {
@ -653,7 +653,7 @@ void DialogPatternProperties::SetDefaultSize(const QString &def)
} }
else else
{ {
const int size = static_cast<int>(pattern->size()); const int size = static_cast<int>(VContainer::size());
index = ui->comboBoxSize->findText(QString().setNum(size)); index = ui->comboBoxSize->findText(QString().setNum(size));
if (index != -1) if (index != -1)
{ {

View File

@ -492,8 +492,8 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height)
if (m->Type() == MeasurementsType::Standard) if (m->Type() == MeasurementsType::Standard)
{ {
pattern->SetSize(size); VContainer::SetSize(size);
pattern->SetHeight(height); VContainer::SetHeight(height);
} }
try try
@ -1128,7 +1128,7 @@ void MainWindow::ClosedDialogGroup(int result)
{ {
DialogGroup *dialog = qobject_cast<DialogGroup*>(dialogTool); DialogGroup *dialog = qobject_cast<DialogGroup*>(dialogTool);
SCASSERT(dialog != nullptr) SCASSERT(dialog != nullptr)
const QDomElement group = doc->CreateGroup(pattern->getNextId(), dialog->GetName(), dialog->GetGroup()); const QDomElement group = doc->CreateGroup(VContainer::getNextId(), dialog->GetName(), dialog->GetGroup());
if (not group.isNull()) if (not group.isNull())
{ {
AddGroup *addGroup = new AddGroup(group, doc); AddGroup *addGroup = new AddGroup(group, doc);
@ -1374,7 +1374,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
FileClosedCorrect(); FileClosedCorrect();
event->accept(); event->accept();
qApp->closeAllWindows(); QApplication::closeAllWindows();
} }
else else
{ {
@ -1560,9 +1560,9 @@ void MainWindow::ShowMeasurements()
<< "-u" << "-u"
<< VDomDocument::UnitsToStr(qApp->patternUnit()) << VDomDocument::UnitsToStr(qApp->patternUnit())
<< "-e" << "-e"
<< QString().setNum(static_cast<int>(UnitConvertor(pattern->height(), doc->MUnit(), Unit::Cm))) << QString().setNum(static_cast<int>(UnitConvertor(VContainer::height(), doc->MUnit(), Unit::Cm)))
<< "-s" << "-s"
<< QString().setNum(static_cast<int>(UnitConvertor(pattern->size(), doc->MUnit(), Unit::Cm))); << QString().setNum(static_cast<int>(UnitConvertor(VContainer::size(), doc->MUnit(), Unit::Cm)));
} }
else else
{ {
@ -1623,7 +1623,7 @@ void MainWindow::SyncMeasurements()
if (mChanges) if (mChanges)
{ {
const QString path = AbsoluteMPath(curFile, doc->MPath()); const QString path = AbsoluteMPath(curFile, doc->MPath());
if(UpdateMeasurements(path, static_cast<int>(pattern->size()), static_cast<int>(pattern->height()))) if(UpdateMeasurements(path, static_cast<int>(VContainer::size()), static_cast<int>(VContainer::height())))
{ {
if (not watcher->files().contains(path)) if (not watcher->files().contains(path))
{ {
@ -1717,7 +1717,7 @@ void MainWindow::ToolBarOption()
ui->toolBarOption->addSeparator(); ui->toolBarOption->addSeparator();
} }
mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(doc->UnitsToStr(qApp->patternUnit(), true))); mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(VDomDocument::UnitsToStr(qApp->patternUnit(), true)));
ui->toolBarOption->addWidget(mouseCoordinate); ui->toolBarOption->addWidget(mouseCoordinate);
} }
@ -1886,7 +1886,7 @@ void MainWindow::MouseMove(const QPointF &scenePos)
//: Coords in status line: "X, Y (units)" //: Coords in status line: "X, Y (units)"
mouseCoordinate->setText(QString("%1, %2 (%3)").arg(static_cast<qint32>(qApp->fromPixel(scenePos.x()))) mouseCoordinate->setText(QString("%1, %2 (%3)").arg(static_cast<qint32>(qApp->fromPixel(scenePos.x())))
.arg(static_cast<qint32>(qApp->fromPixel(scenePos.y()))) .arg(static_cast<qint32>(qApp->fromPixel(scenePos.y())))
.arg(doc->UnitsToStr(qApp->patternUnit(), true))); .arg(VDomDocument::UnitsToStr(qApp->patternUnit(), true)));
} }
} }
@ -3030,7 +3030,7 @@ void MainWindow::New()
AddPP(patternPieceName); AddPP(patternPieceName);
mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(doc->UnitsToStr(qApp->patternUnit(), true))); mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(VDomDocument::UnitsToStr(qApp->patternUnit(), true)));
ui->toolBarOption->addWidget(mouseCoordinate); ui->toolBarOption->addWidget(mouseCoordinate);
} }
else else
@ -3061,8 +3061,8 @@ void MainWindow::PatternChangesWereSaved(bool saved)
*/ */
void MainWindow::ChangedSize(const QString & text) void MainWindow::ChangedSize(const QString & text)
{ {
const int size = static_cast<int>(pattern->size()); const int size = static_cast<int>(VContainer::size());
if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), text.toInt(), static_cast<int>(pattern->height()))) if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), text.toInt(), static_cast<int>(VContainer::height())))
{ {
doc->LiteParseTree(Document::LiteParse); doc->LiteParseTree(Document::LiteParse);
emit sceneDetails->DimensionsChanged(); emit sceneDetails->DimensionsChanged();
@ -3090,8 +3090,8 @@ void MainWindow::ChangedSize(const QString & text)
*/ */
void MainWindow::ChangedHeight(const QString &text) void MainWindow::ChangedHeight(const QString &text)
{ {
const int height = static_cast<int>(pattern->height()); const int height = static_cast<int>(VContainer::height());
if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), static_cast<int>(pattern->size()), text.toInt())) if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), static_cast<int>(VContainer::size()), text.toInt()))
{ {
doc->LiteParseTree(Document::LiteParse); doc->LiteParseTree(Document::LiteParse);
emit sceneDetails->DimensionsChanged(); emit sceneDetails->DimensionsChanged();
@ -3123,13 +3123,13 @@ void MainWindow::SetDefaultHeight()
} }
else else
{ {
index = gradationHeights->findText(QString().setNum(pattern->height())); index = gradationHeights->findText(QString().setNum(VContainer::height()));
if (index != -1) if (index != -1)
{ {
gradationHeights->setCurrentIndex(index); gradationHeights->setCurrentIndex(index);
} }
} }
pattern->SetHeight(gradationHeights->currentText().toInt()); VContainer::SetHeight(gradationHeights->currentText().toInt());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -3143,13 +3143,13 @@ void MainWindow::SetDefaultSize()
} }
else else
{ {
index = gradationSizes->findText(QString().setNum(pattern->size())); index = gradationSizes->findText(QString().setNum(VContainer::size()));
if (index != -1) if (index != -1)
{ {
gradationSizes->setCurrentIndex(index); gradationSizes->setCurrentIndex(index);
} }
} }
pattern->SetSize(gradationSizes->currentText().toInt()); VContainer::SetSize(gradationSizes->currentText().toInt());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -4384,7 +4384,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
QFileInfo table(path); QFileInfo table(path);
if (table.exists() == false) if (table.exists() == false)
{ {
if (!qApp->IsGUIMode()) if (!VApplication::IsGUIMode())
{ {
return QString();// console mode doesn't support fixing path to a measurement file return QString();// console mode doesn't support fixing path to a measurement file
} }
@ -4627,7 +4627,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool MainWindow::SetSize(const QString &text) bool MainWindow::SetSize(const QString &text)
{ {
if (not qApp->IsGUIMode()) if (not VApplication::IsGUIMode())
{ {
if (this->isWindowModified() || not curFile.isEmpty()) if (this->isWindowModified() || not curFile.isEmpty())
{ {
@ -4670,7 +4670,7 @@ bool MainWindow::SetSize(const QString &text)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool MainWindow::SetHeight(const QString &text) bool MainWindow::SetHeight(const QString &text)
{ {
if (not qApp->IsGUIMode()) if (not VApplication::IsGUIMode())
{ {
if (this->isWindowModified() || not curFile.isEmpty()) if (this->isWindowModified() || not curFile.isEmpty())
{ {

View File

@ -487,7 +487,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> *det
QHash<quint32, VPiece>::const_iterator i = details->constBegin(); QHash<quint32, VPiece>::const_iterator i = details->constBegin();
while (i != details->constEnd()) while (i != details->constEnd())
{ {
VAbstractTool *tool = qobject_cast<VAbstractTool*>(doc->getTool(i.key())); VAbstractTool *tool = qobject_cast<VAbstractTool*>(VAbstractPattern::getTool(i.key()));
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
listDetails.append(VLayoutPiece::Create(i.value(), tool->getData())); listDetails.append(VLayoutPiece::Create(i.value(), tool->getData()));
++i; ++i;
@ -643,7 +643,8 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
if (paper) if (paper)
{ {
QPrinter printer; QPrinter printer;
printer.setCreator(qApp->applicationDisplayName()+QLatin1String(" ")+qApp->applicationVersion()); printer.setCreator(QGuiApplication::applicationDisplayName()+QLatin1String(" ")+
QCoreApplication::applicationVersion());
printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(name); printer.setOutputFileName(name);
printer.setDocName(FileName()); printer.setDocName(FileName());
@ -956,7 +957,7 @@ void MainWindowsNoGUI::LayoutPrint()
void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &printType) void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &printType)
{ {
SCASSERT(printer != nullptr) SCASSERT(printer != nullptr)
printer->setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion()); printer->setCreator(QGuiApplication::applicationDisplayName()+" "+QCoreApplication::applicationVersion());
// Set orientation // Set orientation
if (paperSize.height() >= paperSize.width()) if (paperSize.height() >= paperSize.width())

View File

@ -3458,7 +3458,7 @@ QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedNa
QString VPattern::GenerateSuffix() const QString VPattern::GenerateSuffix() const
{ {
const QString suffixBase = GetLabelBase(static_cast<quint32>(GetIndexActivPP())).toLower(); const QString suffixBase = GetLabelBase(static_cast<quint32>(GetIndexActivPP())).toLower();
const QStringList uniqueNames = data->AllUniqueNames(); const QStringList uniqueNames = VContainer::AllUniqueNames();
qint32 num = 1; qint32 num = 1;
QString suffix; QString suffix;
for (;;) for (;;)
@ -3717,7 +3717,7 @@ void VPattern::PrepareForParse(const Document &parse)
} }
else if (parse == Document::LiteParse) else if (parse == Document::LiteParse)
{ {
data->ClearUniqueNames(); VContainer::ClearUniqueNames();
data->ClearVariables(VarType::Increment); data->ClearVariables(VarType::Increment);
data->ClearVariables(VarType::LineAngle); data->ClearVariables(VarType::LineAngle);
data->ClearVariables(VarType::LineLength); data->ClearVariables(VarType::LineLength);

View File

@ -42,7 +42,8 @@ FvUpdateWindow::FvUpdateWindow(QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
// Set the "new version is available" string // Set the "new version is available" string
const QString newVersString = m_ui->newVersionIsAvailableLabel->text().arg(qApp->applicationDisplayName()); const QString newVersString = m_ui->newVersionIsAvailableLabel->text()
.arg(QGuiApplication::applicationDisplayName());
m_ui->newVersionIsAvailableLabel->setText(newVersString); m_ui->newVersionIsAvailableLabel->setText(newVersString);
// Connect buttons // Connect buttons
@ -67,7 +68,8 @@ bool FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate()
} }
const QString downloadString = m_ui->wouldYouLikeToDownloadLabel->text() const QString downloadString = m_ui->wouldYouLikeToDownloadLabel->text()
.arg(qApp->applicationDisplayName(), proposedUpdate->GetEnclosureVersion(), qApp->applicationVersion()); .arg(QGuiApplication::applicationDisplayName(), proposedUpdate->GetEnclosureVersion(),
QCoreApplication::applicationVersion());
m_ui->wouldYouLikeToDownloadLabel->setText(downloadString); m_ui->wouldYouLikeToDownloadLabel->setText(downloadString);
return true; return true;

View File

@ -389,7 +389,7 @@ QT_WARNING_POP
*/ */
bool QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok ) bool QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok )
{ {
const QStringList pOprtDef = m_pParser->GetOprtDef(); const QStringList pOprtDef = QmuParserBase::GetOprtDef();
// Compare token with function and operator strings // Compare token with function and operator strings
// check string for operator/function // check string for operator/function
@ -663,7 +663,7 @@ bool QmuParserTokenReader::IsOprt ( token_type &a_Tok )
} }
// Check if the operator is a built in operator, if so ignore it here // Check if the operator is a built in operator, if so ignore it here
const QStringList &pOprtDef = m_pParser->GetOprtDef(); const QStringList &pOprtDef = QmuParserBase::GetOprtDef();
QStringList::const_iterator constIterator; QStringList::const_iterator constIterator;
for ( constIterator = pOprtDef.constBegin(); m_pParser->HasBuiltInOprt() && constIterator != pOprtDef.constEnd(); for ( constIterator = pOprtDef.constBegin(); m_pParser->HasBuiltInOprt() && constIterator != pOprtDef.constEnd();
++constIterator ) ++constIterator )

View File

@ -675,13 +675,13 @@ bool VMeasurements::IsDefinedKnownNamesValid() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetDataSize() void VMeasurements::SetDataSize()
{ {
data->SetSize(UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit())); VContainer::SetSize(UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetDataHeight() void VMeasurements::SetDataHeight()
{ {
data->SetHeight(UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit())); VContainer::SetHeight(UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -397,14 +397,14 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
const VPieceLabelData& data = piece.GetPatternPieceData(); const VPieceLabelData& data = piece.GetPatternPieceData();
if (data.IsVisible() == true) if (data.IsVisible() == true)
{ {
det.SetDetail(piece.GetName(), data, qApp->font(), pattern); det.SetDetail(piece.GetName(), data, QApplication::font(), pattern);
} }
const VPatternLabelData& geom = piece.GetPatternInfo(); const VPatternLabelData& geom = piece.GetPatternInfo();
if (geom.IsVisible() == true) if (geom.IsVisible() == true)
{ {
VAbstractPattern* pDoc = qApp->getCurrentDocument(); VAbstractPattern* pDoc = qApp->getCurrentDocument();
det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height(), pattern); det.SetPatternInfo(pDoc, geom, QApplication::font(), VContainer::size(), VContainer::height(), pattern);
} }
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry(); const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();

View File

@ -250,7 +250,7 @@ void DialogFlippingByAxis::SuffixChanged()
if (m_suffix != suffix) if (m_suffix != suffix)
{ {
QRegularExpression rx(NameRegExp()); QRegularExpression rx(NameRegExp());
const QStringList uniqueNames = data->AllUniqueNames(); const QStringList uniqueNames = VContainer::AllUniqueNames();
for (int i=0; i < uniqueNames.size(); ++i) for (int i=0; i < uniqueNames.size(); ++i)
{ {
const QString name = uniqueNames.at(i) + suffix; const QString name = uniqueNames.at(i) + suffix;

View File

@ -279,7 +279,7 @@ void DialogFlippingByLine::SuffixChanged()
if (m_suffix != suffix) if (m_suffix != suffix)
{ {
QRegularExpression rx(NameRegExp()); QRegularExpression rx(NameRegExp());
const QStringList uniqueNames = data->AllUniqueNames(); const QStringList uniqueNames = VContainer::AllUniqueNames();
for (int i=0; i < uniqueNames.size(); ++i) for (int i=0; i < uniqueNames.size(); ++i)
{ {
const QString name = uniqueNames.at(i) + suffix; const QString name = uniqueNames.at(i) + suffix;

View File

@ -340,7 +340,7 @@ void DialogMove::SuffixChanged()
if (m_suffix != suffix) if (m_suffix != suffix)
{ {
QRegularExpression rx(NameRegExp()); QRegularExpression rx(NameRegExp());
const QStringList uniqueNames = data->AllUniqueNames(); const QStringList uniqueNames = VContainer::AllUniqueNames();
for (int i=0; i < uniqueNames.size(); ++i) for (int i=0; i < uniqueNames.size(); ++i)
{ {
const QString name = uniqueNames.at(i) + suffix; const QString name = uniqueNames.at(i) + suffix;

View File

@ -321,7 +321,7 @@ void DialogRotation::SuffixChanged()
if (m_suffix != suffix) if (m_suffix != suffix)
{ {
QRegularExpression rx(NameRegExp()); QRegularExpression rx(NameRegExp());
const QStringList uniqueNames = data->AllUniqueNames(); const QStringList uniqueNames = VContainer::AllUniqueNames();
for (int i=0; i < uniqueNames.size(); ++i) for (int i=0; i < uniqueNames.size(); ++i)
{ {
const QString name = uniqueNames.at(i) + suffix; const QString name = uniqueNames.at(i) + suffix;

View File

@ -60,7 +60,7 @@ void VAbstractFlipping::CreateDestination(Source typeCreation, quint32 &id, QVec
{ {
dest.clear();// Try to avoid mistake, value must be empty dest.clear();// Try to avoid mistake, value must be empty
id = data->getNextId();//Just reserve id for tool id = VContainer::getNextId();//Just reserve id for tool
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)
{ {

View File

@ -134,7 +134,7 @@ VToolFlippingByAxis *VToolFlippingByAxis::Create(const quint32 _id, quint32 orig
dest, typeCreation); dest, typeCreation);
scene->addItem(tool); scene->addItem(tool);
InitOperationToolConnections(scene, tool); InitOperationToolConnections(scene, tool);
doc->AddTool(id, tool); VAbstractPattern::AddTool(id, tool);
doc->IncrementReferens(originPoint.getIdTool()); doc->IncrementReferens(originPoint.getIdTool());
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)
{ {
@ -156,7 +156,7 @@ void VToolFlippingByAxis::SetAxisType(AxisType value)
{ {
m_axisType = value; m_axisType = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }

View File

@ -128,7 +128,7 @@ VToolFlippingByLine *VToolFlippingByLine::Create(const quint32 _id, quint32 firs
source, dest, typeCreation); source, dest, typeCreation);
scene->addItem(tool); scene->addItem(tool);
InitOperationToolConnections(scene, tool); InitOperationToolConnections(scene, tool);
doc->AddTool(id, tool); VAbstractPattern::AddTool(id, tool);
doc->IncrementReferens(firstPoint.getIdTool()); doc->IncrementReferens(firstPoint.getIdTool());
doc->IncrementReferens(secondPoint.getIdTool()); doc->IncrementReferens(secondPoint.getIdTool());
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)

View File

@ -62,7 +62,7 @@ void VAbstractOperation::SetSuffix(const QString &suffix)
{ {
// Don't know if need check name here. // Don't know if need check name here.
this->suffix = suffix; this->suffix = suffix;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
@ -423,7 +423,7 @@ VAbstractOperation::VAbstractOperation(VAbstractPattern *doc, VContainer *data,
void VAbstractOperation::AddToFile() void VAbstractOperation::AddToFile()
{ {
QDomElement domElement = doc->createElement(getTagName()); QDomElement domElement = doc->createElement(getTagName());
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOptions(domElement, obj); SaveOptions(domElement, obj);
AddToCalculation(domElement); AddToCalculation(domElement);
} }
@ -434,7 +434,7 @@ void VAbstractOperation::RefreshDataInFile()
QDomElement domElement = doc->elementById(id); QDomElement domElement = doc->elementById(id);
if (domElement.isElement()) if (domElement.isElement())
{ {
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOptions(domElement, obj); SaveOptions(domElement, obj);
} }
else else

View File

@ -130,7 +130,7 @@ VToolMove *VToolMove::Create(quint32 _id, QString &formulaAngle, QString &formul
{ {
dest.clear();// Try to avoid mistake, value must be empty dest.clear();// Try to avoid mistake, value must be empty
id = data->getNextId();//Just reserve id for tool id = VContainer::getNextId();//Just reserve id for tool
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)
{ {
@ -229,7 +229,7 @@ QT_WARNING_POP
typeCreation); typeCreation);
scene->addItem(tool); scene->addItem(tool);
InitOperationToolConnections(scene, tool); InitOperationToolConnections(scene, tool);
doc->AddTool(id, tool); VAbstractPattern::AddTool(id, tool);
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)
{ {
doc->IncrementReferens(data->GetGObject(source.at(i))->getIdTool()); doc->IncrementReferens(data->GetGObject(source.at(i))->getIdTool());
@ -256,7 +256,7 @@ void VToolMove::SetFormulaAngle(const VFormula &value)
{ {
formulaAngle = value.GetFormula(FormulaType::FromUser); formulaAngle = value.GetFormula(FormulaType::FromUser);
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }
@ -278,7 +278,7 @@ void VToolMove::SetFormulaLength(const VFormula &value)
{ {
formulaLength = value.GetFormula(FormulaType::FromUser); formulaLength = value.GetFormula(FormulaType::FromUser);
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }

View File

@ -148,7 +148,7 @@ VToolRotation *VToolRotation::Create(const quint32 _id, const quint32 &origin, Q
{ {
dest.clear();// Try to avoid mistake, value must be empty dest.clear();// Try to avoid mistake, value must be empty
id = data->getNextId();//Just reserve id for tool id = VContainer::getNextId();//Just reserve id for tool
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)
{ {
@ -244,7 +244,7 @@ QT_WARNING_POP
VToolRotation *tool = new VToolRotation(doc, data, id, origin, angle, suffix, source, dest, typeCreation); VToolRotation *tool = new VToolRotation(doc, data, id, origin, angle, suffix, source, dest, typeCreation);
scene->addItem(tool); scene->addItem(tool);
InitOperationToolConnections(scene, tool); InitOperationToolConnections(scene, tool);
doc->AddTool(id, tool); VAbstractPattern::AddTool(id, tool);
doc->IncrementReferens(originPoint.getIdTool()); doc->IncrementReferens(originPoint.getIdTool());
for (int i = 0; i < source.size(); ++i) for (int i = 0; i < source.size(); ++i)
{ {
@ -278,7 +278,7 @@ void VToolRotation::SetFormulaAngle(const VFormula &value)
{ {
formulaAngle = value.GetFormula(FormulaType::FromUser); formulaAngle = value.GetFormula(FormulaType::FromUser);
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }

View File

@ -174,7 +174,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
scene->addItem(toolArc); scene->addItem(toolArc);
InitArcToolConnections(scene, toolArc); InitArcToolConnections(scene, toolArc);
doc->AddTool(id, toolArc); VAbstractPattern::AddTool(id, toolArc);
doc->IncrementReferens(c.getIdTool()); doc->IncrementReferens(c.getIdTool());
return toolArc; return toolArc;
} }

View File

@ -144,7 +144,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation); VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation);
scene->addItem(toolArc); scene->addItem(toolArc);
InitArcToolConnections(scene, toolArc); InitArcToolConnections(scene, toolArc);
doc->AddTool(id, toolArc); VAbstractPattern::AddTool(id, toolArc);
doc->IncrementReferens(c.getIdTool()); doc->IncrementReferens(c.getIdTool());
return toolArc; return toolArc;
} }

View File

@ -132,7 +132,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
auto _spl = new VToolCubicBezier(doc, data, id, typeCreation); auto _spl = new VToolCubicBezier(doc, data, id, typeCreation);
scene->addItem(_spl); scene->addItem(_spl);
InitSplineToolConnections(scene, _spl); InitSplineToolConnections(scene, _spl);
doc->AddTool(id, _spl); VAbstractPattern::AddTool(id, _spl);
doc->IncrementReferens(spline->GetP1().getIdTool()); doc->IncrementReferens(spline->GetP1().getIdTool());
doc->IncrementReferens(spline->GetP1().getIdTool()); doc->IncrementReferens(spline->GetP1().getIdTool());
doc->IncrementReferens(spline->GetP1().getIdTool()); doc->IncrementReferens(spline->GetP1().getIdTool());

View File

@ -137,7 +137,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation); VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation);
scene->addItem(spl); scene->addItem(spl);
InitSplinePathToolConnections(scene, spl); InitSplinePathToolConnections(scene, spl);
doc->AddTool(id, spl); VAbstractPattern::AddTool(id, spl);
return spl; return spl;
} }
return nullptr; return nullptr;

View File

@ -188,7 +188,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(const quint32 _id, const quint32
VToolEllipticalArc *toolEllipticalArc = new VToolEllipticalArc(doc, data, id, typeCreation); VToolEllipticalArc *toolEllipticalArc = new VToolEllipticalArc(doc, data, id, typeCreation);
scene->addItem(toolEllipticalArc); scene->addItem(toolEllipticalArc);
InitElArcToolConnections(scene, toolEllipticalArc); InitElArcToolConnections(scene, toolEllipticalArc);
doc->AddTool(id, toolEllipticalArc); VAbstractPattern::AddTool(id, toolEllipticalArc);
doc->IncrementReferens(c.getIdTool()); doc->IncrementReferens(c.getIdTool());
return toolEllipticalArc; return toolEllipticalArc;
} }

View File

@ -209,7 +209,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
auto _spl = new VToolSpline(doc, data, id, typeCreation); auto _spl = new VToolSpline(doc, data, id, typeCreation);
scene->addItem(_spl); scene->addItem(_spl);
InitSplineToolConnections(scene, _spl); InitSplineToolConnections(scene, _spl);
doc->AddTool(id, _spl); VAbstractPattern::AddTool(id, _spl);
doc->IncrementReferens(spline->GetP1().getIdTool()); doc->IncrementReferens(spline->GetP1().getIdTool());
doc->IncrementReferens(spline->GetP4().getIdTool()); doc->IncrementReferens(spline->GetP4().getIdTool());
return _spl; return _spl;

View File

@ -220,7 +220,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
scene->addItem(spl); scene->addItem(spl);
InitSplinePathToolConnections(scene, spl); InitSplinePathToolConnections(scene, spl);
doc->AddTool(id, spl); VAbstractPattern::AddTool(id, spl);
return spl; return spl;
} }
return nullptr; return nullptr;

View File

@ -386,7 +386,7 @@ void VToolDoublePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &o
void VToolDoublePoint::AddToFile() void VToolDoublePoint::AddToFile()
{ {
QDomElement domElement = doc->createElement(getTagName()); QDomElement domElement = doc->createElement(getTagName());
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOptions(domElement, obj); SaveOptions(domElement, obj);
AddToCalculation(domElement); AddToCalculation(domElement);
} }
@ -397,7 +397,7 @@ void VToolDoublePoint::RefreshDataInFile()
QDomElement domElement = doc->elementById(id); QDomElement domElement = doc->elementById(id);
if (domElement.isElement()) if (domElement.isElement())
{ {
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOptions(domElement, obj); SaveOptions(domElement, obj);
} }
else else

View File

@ -173,7 +173,7 @@ VToolTrueDarts *VToolTrueDarts::Create(quint32 _id,
quint32 p2id = _p2id; quint32 p2id = _p2id;
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)
{ {
id = data->getNextId();//Just reserve id for tool id = VContainer::getNextId();//Just reserve id for tool
p1id = data->AddGObject(new VPointF(fPoint1, point1Name, mx1, my1, id)); p1id = data->AddGObject(new VPointF(fPoint1, point1Name, mx1, my1, id));
p2id = data->AddGObject(new VPointF(fPoint2, point2Name, mx2, my2, id)); p2id = data->AddGObject(new VPointF(fPoint2, point2Name, mx2, my2, id));
} }
@ -194,7 +194,7 @@ VToolTrueDarts *VToolTrueDarts::Create(quint32 _id,
dartP1Id, dartP2Id, dartP3Id, typeCreation); dartP1Id, dartP2Id, dartP3Id, typeCreation);
scene->addItem(points); scene->addItem(points);
InitToolConnections(scene, points); InitToolConnections(scene, points);
doc->AddTool(id, points); VAbstractPattern::AddTool(id, points);
doc->IncrementReferens(baseLineP1->getIdTool()); doc->IncrementReferens(baseLineP1->getIdTool());
doc->IncrementReferens(baseLineP2->getIdTool()); doc->IncrementReferens(baseLineP2->getIdTool());
doc->IncrementReferens(dartP1->getIdTool()); doc->IncrementReferens(dartP1->getIdTool());
@ -254,7 +254,7 @@ void VToolTrueDarts::SetBaseLineP1Id(const quint32 &value)
{ {
baseLineP1Id = value; baseLineP1Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }
@ -272,7 +272,7 @@ void VToolTrueDarts::SetBaseLineP2Id(const quint32 &value)
{ {
baseLineP2Id = value; baseLineP2Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }
@ -290,7 +290,7 @@ void VToolTrueDarts::SetDartP1Id(const quint32 &value)
{ {
dartP1Id = value; dartP1Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }
@ -308,7 +308,7 @@ void VToolTrueDarts::SetDartP2Id(const quint32 &value)
{ {
dartP2Id = value; dartP2Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }
@ -326,7 +326,7 @@ void VToolTrueDarts::SetDartP3Id(const quint32 &value)
{ {
dartP3Id = value; dartP3Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetFakeGObject(id); QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
SaveOption(obj); SaveOption(obj);
} }
} }

View File

@ -108,7 +108,7 @@ inline void VToolCut::ShowToolVisualization(bool show)
delete vis; delete vis;
} }
VDataTool *parent = doc->getTool(VAbstractTool::data.GetGObject(curveCutId)->getIdTool()); VDataTool *parent = VAbstractPattern::getTool(VAbstractTool::data.GetGObject(curveCutId)->getIdTool());
if (VAbstractSpline *parentCurve = qobject_cast<VAbstractSpline *>(parent)) if (VAbstractSpline *parentCurve = qobject_cast<VAbstractSpline *>(parent))
{ {
detailsMode ? parentCurve->ShowHandles(detailsMode) : parentCurve->ShowHandles(show); detailsMode ? parentCurve->ShowHandles(detailsMode) : parentCurve->ShowHandles(show);

View File

@ -148,8 +148,8 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)
{ {
id = data->AddGObject(p); id = data->AddGObject(p);
a1->setId(data->getNextId()); a1->setId(VContainer::getNextId());
a2->setId(data->getNextId()); a2->setId(VContainer::getNextId());
data->AddArc(a1, a1->id(), id); data->AddArc(a1, a1->id(), id);
data->AddArc(a2, a2->id(), id); data->AddArc(a2, a2->id(), id);
} }
@ -173,7 +173,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, typeCreation); VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(arc->getIdTool()); doc->IncrementReferens(arc->getIdTool());
return point; return point;
} }

View File

@ -174,7 +174,7 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, typeCreation); VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(spl->getIdTool()); doc->IncrementReferens(spl->getIdTool());
return point; return point;
} }

View File

@ -185,7 +185,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, typeCreation); VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(splPath->getIdTool()); doc->IncrementReferens(splPath->getIdTool());
return point; return point;
} }

View File

@ -306,7 +306,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool()); doc->IncrementReferens(secondPoint->getIdTool());
} }

View File

@ -219,7 +219,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
secondPointId, thirdPointId, typeCreation); secondPointId, thirdPointId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool()); doc->IncrementReferens(secondPoint->getIdTool());
doc->IncrementReferens(thirdPoint->getIdTool()); doc->IncrementReferens(thirdPoint->getIdTool());

View File

@ -148,8 +148,8 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
id = data->AddGObject(p); id = data->AddGObject(p);
data->AddLine(basePointId, id); data->AddLine(basePointId, id);
data->getNextId(); VContainer::getNextId();
data->getNextId(); VContainer::getNextId();
InitSegments(curve->getType(), segLength, p, curveId, data); InitSegments(curve->getType(), segLength, p, curveId, data);
} }
else else
@ -172,7 +172,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
basePointId, curveId, typeCreation); basePointId, curveId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(basePoint->getIdTool()); doc->IncrementReferens(basePoint->getIdTool());
doc->IncrementReferens(curve->getIdTool()); doc->IncrementReferens(curve->getIdTool());
return point; return point;

View File

@ -186,7 +186,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
basePointId, typeCreation); basePointId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(basePoint->getIdTool()); doc->IncrementReferens(basePoint->getIdTool());
return point; return point;
} }

View File

@ -178,7 +178,7 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(basePoint->getIdTool()); doc->IncrementReferens(basePoint->getIdTool());
doc->IncrementReferens(p1Line->getIdTool()); doc->IncrementReferens(p1Line->getIdTool());
doc->IncrementReferens(p2Line->getIdTool()); doc->IncrementReferens(p2Line->getIdTool());

View File

@ -160,7 +160,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(basePoint->getIdTool()); doc->IncrementReferens(basePoint->getIdTool());
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool()); doc->IncrementReferens(secondPoint->getIdTool());

View File

@ -182,7 +182,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
secondPointId, typeCreation); secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool()); doc->IncrementReferens(secondPoint->getIdTool());
return point; return point;

View File

@ -229,7 +229,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool()); doc->IncrementReferens(secondPoint->getIdTool());
doc->IncrementReferens(shoulderPoint->getIdTool()); doc->IncrementReferens(shoulderPoint->getIdTool());

View File

@ -138,7 +138,7 @@ VToolBasePoint *VToolBasePoint::Create(quint32 _id, const QString &nameActivPP,
VToolBasePoint *spoint = new VToolBasePoint(doc, data, id, typeCreation, nameActivPP); VToolBasePoint *spoint = new VToolBasePoint(doc, data, id, typeCreation, nameActivPP);
scene->addItem(spoint); scene->addItem(spoint);
InitToolConnections(scene, spoint); InitToolConnections(scene, spoint);
doc->AddTool(id, spoint); VAbstractPattern::AddTool(id, spoint);
return spoint; return spoint;
} }
return nullptr; return nullptr;

View File

@ -188,7 +188,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
p2Line2Id, typeCreation); p2Line2Id, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(p1Line1->getIdTool()); doc->IncrementReferens(p1Line1->getIdTool());
doc->IncrementReferens(p2Line1->getIdTool()); doc->IncrementReferens(p2Line1->getIdTool());
doc->IncrementReferens(p1Line2->getIdTool()); doc->IncrementReferens(p1Line2->getIdTool());

View File

@ -130,7 +130,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _
crossPoint, typeCreation); crossPoint, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(arc.getIdTool()); doc->IncrementReferens(arc.getIdTool());
doc->IncrementReferens(tPoint.getIdTool()); doc->IncrementReferens(tPoint.getIdTool());
return point; return point;

View File

@ -140,7 +140,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const qui
crossPoint, typeCreation); crossPoint, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(cPoint.getIdTool()); doc->IncrementReferens(cPoint.getIdTool());
doc->IncrementReferens(tPoint.getIdTool()); doc->IncrementReferens(tPoint.getIdTool());
return point; return point;

View File

@ -241,7 +241,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
firstPointId, secondPointId, typeCreation); firstPointId, secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(centerP->getIdTool()); doc->IncrementReferens(centerP->getIdTool());
doc->IncrementReferens(firstP->getIdTool()); doc->IncrementReferens(firstP->getIdTool());
doc->IncrementReferens(secondP->getIdTool()); doc->IncrementReferens(secondP->getIdTool());

View File

@ -163,7 +163,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
secondPointId, typeCreation); secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool()); doc->IncrementReferens(secondPoint->getIdTool());
return point; return point;

View File

@ -131,7 +131,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32
secondArcId, pType, typeCreation); secondArcId, pType, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(firstArc->getIdTool()); doc->IncrementReferens(firstArc->getIdTool());
doc->IncrementReferens(secondArc->getIdTool()); doc->IncrementReferens(secondArc->getIdTool());
return point; return point;

View File

@ -152,7 +152,7 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const q
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(c1Point.getIdTool()); doc->IncrementReferens(c1Point.getIdTool());
doc->IncrementReferens(c2Point.getIdTool()); doc->IncrementReferens(c2Point.getIdTool());
return point; return point;

View File

@ -140,7 +140,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const qui
hCrossPoint, typeCreation); hCrossPoint, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(curve1->getIdTool()); doc->IncrementReferens(curve1->getIdTool());
doc->IncrementReferens(curve2->getIdTool()); doc->IncrementReferens(curve2->getIdTool());
return point; return point;

View File

@ -173,7 +173,7 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
secondPointId, typeCreation); secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
doc->IncrementReferens(axisP1->getIdTool()); doc->IncrementReferens(axisP1->getIdTool());
doc->IncrementReferens(axisP2->getIdTool()); doc->IncrementReferens(axisP2->getIdTool());
doc->IncrementReferens(firstPoint->getIdTool()); doc->IncrementReferens(firstPoint->getIdTool());

View File

@ -268,7 +268,7 @@ void VDrawTool::DialogLinkDestroy()
*/ */
void VDrawTool::SetFactor(qreal factor) void VDrawTool::SetFactor(qreal factor)
{ {
CheckFactor(this->factor, factor); CheckFactor(VDrawTool::factor, factor);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -153,7 +153,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
quint32 id = _id; quint32 id = _id;
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)
{ {
id = data->getNextId(); id = VContainer::getNextId();
data->AddLine(firstPoint, secondPoint); data->AddLine(firstPoint, secondPoint);
} }
else else
@ -174,7 +174,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
InitDrawToolConnections(scene, line); InitDrawToolConnections(scene, line);
connect(scene, &VMainGraphicsScene::EnableLineItemSelection, line, &VToolLine::AllowSelecting); connect(scene, &VMainGraphicsScene::EnableLineItemSelection, line, &VToolLine::AllowSelecting);
connect(scene, &VMainGraphicsScene::EnableLineItemHover, line, &VToolLine::AllowHover); connect(scene, &VMainGraphicsScene::EnableLineItemHover, line, &VToolLine::AllowHover);
doc->AddTool(id, line); VAbstractPattern::AddTool(id, line);
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint); const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint); const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);

View File

@ -78,11 +78,11 @@ void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint
VAbstractTool::AddRecord(id, Tool::NodeArc, doc); VAbstractTool::AddRecord(id, Tool::NodeArc, doc);
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc); VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc);
doc->AddTool(id, arc); VAbstractPattern::AddTool(id, arc);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
arc->setParent(tool);// Adopted by a tool arc->setParent(tool);// Adopted by a tool
} }

View File

@ -51,11 +51,11 @@ void VNodeEllipticalArc::Create(VAbstractPattern *doc, VContainer *data, quint32
VAbstractTool::AddRecord(id, Tool::NodeElArc, doc); VAbstractTool::AddRecord(id, Tool::NodeElArc, doc);
VNodeEllipticalArc *arc = new VNodeEllipticalArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc); VNodeEllipticalArc *arc = new VNodeEllipticalArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc);
doc->AddTool(id, arc); VAbstractPattern::AddTool(id, arc);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
arc->setParent(tool);// Adopted by a tool arc->setParent(tool);// Adopted by a tool
} }

View File

@ -120,11 +120,11 @@ void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsSc
connect(scene, &VMainGraphicsScene::EnablePointItemSelection, point, &VNodePoint::AllowSelecting); connect(scene, &VMainGraphicsScene::EnablePointItemSelection, point, &VNodePoint::AllowSelecting);
connect(scene, &VMainGraphicsScene::EnableLabelItemHover, point, &VNodePoint::AllowLabelHover); connect(scene, &VMainGraphicsScene::EnableLabelItemHover, point, &VNodePoint::AllowLabelHover);
connect(scene, &VMainGraphicsScene::EnableLabelItemSelection, point, &VNodePoint::AllowLabelSelecting); connect(scene, &VMainGraphicsScene::EnableLabelItemSelection, point, &VNodePoint::AllowLabelSelecting);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
point->setParent(tool);// Adopted by a tool point->setParent(tool);// Adopted by a tool
} }

View File

@ -81,11 +81,11 @@ VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, quint3
VAbstractTool::AddRecord(id, Tool::NodeSpline, doc); VAbstractTool::AddRecord(id, Tool::NodeSpline, doc);
spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, drawName, idTool, doc); spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, drawName, idTool, doc);
doc->AddTool(id, spl); VAbstractPattern::AddTool(id, spl);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
spl->setParent(tool);// Adopted by a tool spl->setParent(tool);// Adopted by a tool
} }

View File

@ -80,11 +80,11 @@ void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, quint32 id
VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc); VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc);
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, drawName, idTool, doc); VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, drawName, idTool, doc);
doc->AddTool(id, splPath); VAbstractPattern::AddTool(id, splPath);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
splPath->setParent(tool);// Adopted by a tool splPath->setParent(tool);// Adopted by a tool
} }

View File

@ -75,11 +75,11 @@ VToolPiecePath *VToolPiecePath::Create(quint32 _id, const VPiecePath &path, quin
//Better check garbage before each saving file. Check only modeling tags. //Better check garbage before each saving file. Check only modeling tags.
VToolPiecePath *pathTool = new VToolPiecePath(doc, data, id, pieceId, typeCreation, drawName, idTool, doc); VToolPiecePath *pathTool = new VToolPiecePath(doc, data, id, pieceId, typeCreation, drawName, idTool, doc);
doc->AddTool(id, pathTool); VAbstractPattern::AddTool(id, pathTool);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr);
pathTool->setParent(tool);// Adopted by a tool pathTool->setParent(tool);// Adopted by a tool
} }
@ -88,7 +88,7 @@ VToolPiecePath *VToolPiecePath::Create(quint32 _id, const VPiecePath &path, quin
if (typeCreation == Source::FromGui && path.GetType() == PiecePathType::InternalPath) if (typeCreation == Source::FromGui && path.GetType() == PiecePathType::InternalPath)
{ // Seam allowance tool already initializated and can't init the path { // Seam allowance tool already initializated and can't init the path
SCASSERT(pieceId > NULL_ID); SCASSERT(pieceId > NULL_ID);
VToolSeamAllowance *saTool = qobject_cast<VToolSeamAllowance*>(doc->getTool(pieceId)); VToolSeamAllowance *saTool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(pieceId));
SCASSERT(saTool != nullptr); SCASSERT(saTool != nullptr);
pathTool->setParentItem(saTool); pathTool->setParentItem(saTool);
pathTool->SetParentType(ParentType::Item); pathTool->SetParentType(ParentType::Item);

View File

@ -82,11 +82,11 @@ VToolPin *VToolPin::Create(quint32 _id, quint32 pointId, quint32 pieceId, VAbstr
{ {
point = new VToolPin(doc, data, id, pointId, pieceId, typeCreation, drawName, idTool, doc); point = new VToolPin(doc, data, id, pointId, pieceId, typeCreation, drawName, idTool, doc);
doc->AddTool(id, point); VAbstractPattern::AddTool(id, point);
if (idTool != NULL_ID) if (idTool != NULL_ID)
{ {
//Some nodes we don't show on scene. Tool that create this nodes must free memory. //Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool); VDataTool *tool = VAbstractPattern::getTool(idTool);
SCASSERT(tool != nullptr) SCASSERT(tool != nullptr)
point->setParent(tool);// Adopted by a tool point->setParent(tool);// Adopted by a tool
} }

View File

@ -278,7 +278,7 @@ int VAbstractTool::ConfirmDeletion()
msgBox.setText(tr("Do you really want to delete?")); msgBox.setText(tr("Do you really want to delete?"));
msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setDefaultButton(QDialogButtonBox::No);
msgBox.setIconPixmap(qApp->style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32) ); msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32) );
int dialogResult = msgBox.exec(); int dialogResult = msgBox.exec();

View File

@ -145,7 +145,7 @@ VToolSeamAllowance *VToolSeamAllowance::Create(quint32 id, VPiece newPiece, QStr
connect(scene, &VMainGraphicsScene::EnableDetailItemHover, piece, &VToolSeamAllowance::AllowHover); connect(scene, &VMainGraphicsScene::EnableDetailItemHover, piece, &VToolSeamAllowance::AllowHover);
connect(scene, &VMainGraphicsScene::EnableDetailItemSelection, piece, &VToolSeamAllowance::AllowSelecting); connect(scene, &VMainGraphicsScene::EnableDetailItemSelection, piece, &VToolSeamAllowance::AllowSelecting);
connect(scene, &VMainGraphicsScene::HighlightDetail, piece, &VToolSeamAllowance::Highlight); connect(scene, &VMainGraphicsScene::HighlightDetail, piece, &VToolSeamAllowance::Highlight);
doc->AddTool(id, piece); VAbstractPattern::AddTool(id, piece);
} }
//Very important to delete it. Only this tool need this special variable. //Very important to delete it. Only this tool need this special variable.
data->RemoveVariable(currentSeamAllowance); data->RemoveVariable(currentSeamAllowance);
@ -198,7 +198,7 @@ void VToolSeamAllowance::InsertNode(VPieceNode node, quint32 pieceId, VMainGraph
newDet.GetPath().Append(node); newDet.GetPath().Append(node);
// Seam allowance tool already initializated and can't init the node // Seam allowance tool already initializated and can't init the node
VToolSeamAllowance *saTool = qobject_cast<VToolSeamAllowance*>(doc->getTool(pieceId)); VToolSeamAllowance *saTool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(pieceId));
SCASSERT(saTool != nullptr); SCASSERT(saTool != nullptr);
InitNode(node, scene, data, doc, saTool); InitNode(node, scene, data, doc, saTool);
@ -568,7 +568,7 @@ void VToolSeamAllowance::UpdateLabel()
} }
m_dataLabel->SetMoveType(type); m_dataLabel->SetMoveType(type);
QFont fnt = qApp->font(); QFont fnt = QApplication::font();
{ {
const int iFS = labelData.GetFontSize(); const int iFS = labelData.GetFontSize();
iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS); iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS);
@ -624,7 +624,7 @@ void VToolSeamAllowance::UpdatePatternInfo()
} }
m_patternInfo->SetMoveType(type); m_patternInfo->SetMoveType(type);
QFont fnt = qApp->font(); QFont fnt = QApplication::font();
int iFS = geom.GetFontSize(); int iFS = geom.GetFontSize();
if (iFS < MIN_FONT_SIZE) if (iFS < MIN_FONT_SIZE)
{ {
@ -634,7 +634,7 @@ void VToolSeamAllowance::UpdatePatternInfo()
m_patternInfo->SetFont(fnt); m_patternInfo->SetFont(fnt);
m_patternInfo->SetSize(ToPixel(labelWidth, *VDataTool::data.GetPatternUnit()), m_patternInfo->SetSize(ToPixel(labelWidth, *VDataTool::data.GetPatternUnit()),
ToPixel(labelHeight, *VDataTool::data.GetPatternUnit())); ToPixel(labelHeight, *VDataTool::data.GetPatternUnit()));
m_patternInfo->UpdateData(doc, getData()->size(), getData()->height()); m_patternInfo->UpdateData(doc, VContainer::size(), VContainer::height());
QRectF rectBB; QRectF rectBB;
rectBB.setTopLeft(pos); rectBB.setTopLeft(pos);
@ -1217,7 +1217,7 @@ void VToolSeamAllowance::UpdateExcludeState()
const VPieceNode &node = detail.GetPath().at(i); const VPieceNode &node = detail.GetPath().at(i);
if (node.GetTypeTool() == Tool::NodePoint) if (node.GetTypeTool() == Tool::NodePoint)
{ {
VNodePoint *tool = qobject_cast<VNodePoint*>(doc->getTool(node.GetId())); VNodePoint *tool = qobject_cast<VNodePoint*>(VAbstractPattern::getTool(node.GetId()));
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr);
tool->SetExluded(node.IsExcluded()); tool->SetExluded(node.IsExcluded());
@ -1474,7 +1474,7 @@ void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *sc
{ {
case (Tool::NodePoint): case (Tool::NodePoint):
{ {
VNodePoint *tool = qobject_cast<VNodePoint*>(doc->getTool(node.GetId())); VNodePoint *tool = qobject_cast<VNodePoint*>(VAbstractPattern::getTool(node.GetId()));
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr);
connect(tool, &VNodePoint::ShowContextMenu, parent, &VToolSeamAllowance::contextMenuEvent); connect(tool, &VNodePoint::ShowContextMenu, parent, &VToolSeamAllowance::contextMenuEvent);
@ -1512,7 +1512,7 @@ void VToolSeamAllowance::InitInternalPaths(const VPiece &detail)
{ {
for (int i = 0; i < detail.GetInternalPaths().size(); ++i) for (int i = 0; i < detail.GetInternalPaths().size(); ++i)
{ {
VToolPiecePath *tool = qobject_cast<VToolPiecePath*>(doc->getTool(detail.GetInternalPaths().at(i))); auto *tool = qobject_cast<VToolPiecePath*>(VAbstractPattern::getTool(detail.GetInternalPaths().at(i)));
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr);
tool->setParentItem(this); tool->setParentItem(this);
tool->SetParentType(ParentType::Item); tool->SetParentType(ParentType::Item);

View File

@ -1299,7 +1299,7 @@ void CreateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, q
auto RemoveDetail = [initData](quint32 id) auto RemoveDetail = [initData](quint32 id)
{ {
VToolSeamAllowance *toolDet = qobject_cast<VToolSeamAllowance*>(initData.doc->getTool(id)); VToolSeamAllowance *toolDet = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(id));
SCASSERT(toolDet != nullptr); SCASSERT(toolDet != nullptr);
bool ask = false; bool ask = false;
toolDet->Remove(ask); toolDet->Remove(ask);
@ -1472,7 +1472,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VToolUnion
quint32 id = _id; quint32 id = _id;
if (initData.typeCreation == Source::FromGui) if (initData.typeCreation == Source::FromGui)
{ {
id = initData.data->getNextId(); id = VContainer::getNextId();
} }
else else
{ {
@ -1488,7 +1488,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VToolUnion
VAbstractTool::AddRecord(id, Tool::UnionDetails, initData.doc); VAbstractTool::AddRecord(id, Tool::UnionDetails, initData.doc);
//Scene doesn't show this tool, so doc will destroy this object. //Scene doesn't show this tool, so doc will destroy this object.
unionDetails = new VToolUnionDetails(id, initData); unionDetails = new VToolUnionDetails(id, initData);
initData.doc->AddTool(id, unionDetails); VAbstractPattern::AddTool(id, unionDetails);
// Unfortunatelly doc will destroy all objects only in the end, but we should delete them before each FullParse // Unfortunatelly doc will destroy all objects only in the end, but we should delete them before each FullParse
initData.doc->AddToolOnRemove(unionDetails); initData.doc->AddToolOnRemove(unionDetails);
} }

View File

@ -98,7 +98,7 @@ void DeletePiece::redo()
// UnionDetails delete two old details and create one new. // UnionDetails delete two old details and create one new.
// So when UnionDetail delete detail we can't use FullParsing. So we hide detail on scene directly. // So when UnionDetail delete detail we can't use FullParsing. So we hide detail on scene directly.
VToolSeamAllowance *toolDet = qobject_cast<VToolSeamAllowance*>(doc->getTool(nodeId)); VToolSeamAllowance *toolDet = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(nodeId));
SCASSERT(toolDet != nullptr); SCASSERT(toolDet != nullptr);
toolDet->hide(); toolDet->hide();

View File

@ -50,8 +50,8 @@ void TST_VMeasurements::CreateEmptyStandardFile()
const int size = 50; const int size = 50;
QSharedPointer<VContainer> data = QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit)); QSharedPointer<VContainer> data = QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit));
data->SetHeight(height); VContainer::SetHeight(height);
data->SetSize(size); VContainer::SetSize(size);
QSharedPointer<VMeasurements> m = QSharedPointer<VMeasurements> m =
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data())); QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data()));
@ -138,8 +138,8 @@ void TST_VMeasurements::ValidPMCodesStandardFile()
const int size = 50; const int size = 50;
QSharedPointer<VContainer> data = QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit)); QSharedPointer<VContainer> data = QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit));
data->SetHeight(height); VContainer::SetHeight(height);
data->SetSize(size); VContainer::SetSize(size);
QSharedPointer<VMeasurements> m = QSharedPointer<VMeasurements> m =
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data())); QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data()));