New option Measurements->Unload measurements.
--HG-- branch : develop
This commit is contained in:
parent
f1796eaf90
commit
caa1a46b01
|
@ -1140,6 +1140,7 @@ void MainWindow::LoadIndividual()
|
|||
{
|
||||
watcher->removePath(AbsoluteMPath(curFile, doc->MPath()));
|
||||
}
|
||||
ui->actionUnloadMeasurements->setEnabled(true);
|
||||
doc->SetPath(RelativeMPath(curFile, mPath));
|
||||
watcher->addPath(mPath);
|
||||
PatternWasModified(false);
|
||||
|
@ -1166,6 +1167,7 @@ void MainWindow::LoadStandard()
|
|||
{
|
||||
watcher->removePath(AbsoluteMPath(curFile, doc->MPath()));
|
||||
}
|
||||
ui->actionUnloadMeasurements->setEnabled(true);
|
||||
doc->SetPath(RelativeMPath(curFile, mPath));
|
||||
watcher->addPath(mPath);
|
||||
PatternWasModified(false);
|
||||
|
@ -1176,6 +1178,31 @@ void MainWindow::LoadStandard()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::UnloadMeasurements()
|
||||
{
|
||||
if (doc->MPath().isEmpty())
|
||||
{
|
||||
ui->actionUnloadMeasurements->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (doc->ListMeasurements().isEmpty())
|
||||
{
|
||||
watcher->removePath(AbsoluteMPath(curFile, doc->MPath()));
|
||||
doc->SetPath(QString());
|
||||
PatternWasModified(false);
|
||||
ui->actionShowM->setEnabled(false);
|
||||
ui->actionUnloadMeasurements->setDisabled(true);
|
||||
helpLabel->setText(tr("Measurements unloaded"));
|
||||
}
|
||||
else
|
||||
{
|
||||
qCWarning(vMainWindow, "%s",
|
||||
qUtf8Printable(tr("Couldn't unload measurements. Some of them are used in the pattern.")));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::CreateMeasurements()
|
||||
{
|
||||
|
@ -2132,6 +2159,7 @@ void MainWindow::Clear()
|
|||
ui->actionShowCurveDetails->setEnabled(false);
|
||||
ui->actionLoadIndividual->setEnabled(false);
|
||||
ui->actionLoadStandard->setEnabled(false);
|
||||
ui->actionUnloadMeasurements->setEnabled(false);
|
||||
ui->actionShowM->setEnabled(false);
|
||||
SetEnableTool(false);
|
||||
qApp->setPatternUnit(Unit::Cm);
|
||||
|
@ -2375,6 +2403,7 @@ void MainWindow::SetEnableWidgets(bool enable)
|
|||
ui->actionShowCurveDetails->setEnabled(enable);
|
||||
ui->actionLoadIndividual->setEnabled(enable);
|
||||
ui->actionLoadStandard->setEnabled(enable);
|
||||
ui->actionUnloadMeasurements->setEnabled(enable);
|
||||
|
||||
//Now we don't want allow user call context menu
|
||||
sceneDraw->SetDisableTools(!enable, doc->GetNameActivPP());
|
||||
|
@ -3178,6 +3207,7 @@ void MainWindow::CreateActions()
|
|||
}
|
||||
|
||||
connect(ui->actionSyncMeasurements, &QAction::triggered, this, &MainWindow::SyncMeasurements);
|
||||
connect(ui->actionUnloadMeasurements, &QAction::triggered, this, &MainWindow::UnloadMeasurements);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -3336,6 +3366,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
|
|||
}
|
||||
else
|
||||
{
|
||||
ui->actionUnloadMeasurements->setEnabled(true);
|
||||
watcher->addPath(path);
|
||||
ui->actionShowM->setEnabled(true);
|
||||
}
|
||||
|
|
|
@ -163,6 +163,7 @@ protected:
|
|||
private slots:
|
||||
void LoadIndividual();
|
||||
void LoadStandard();
|
||||
void UnloadMeasurements();
|
||||
void CreateMeasurements();
|
||||
void ShowMeasurements();
|
||||
void MeasurementsChanged(const QString &path);
|
||||
|
|
|
@ -1090,6 +1090,7 @@
|
|||
<addaction name="actionTable"/>
|
||||
<addaction name="actionLoadIndividual"/>
|
||||
<addaction name="actionLoadStandard"/>
|
||||
<addaction name="actionUnloadMeasurements"/>
|
||||
<addaction name="actionCreateNew"/>
|
||||
<addaction name="actionShowM"/>
|
||||
<addaction name="actionSyncMeasurements"/>
|
||||
|
@ -1991,6 +1992,20 @@
|
|||
<string notr="true"/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUnloadMeasurements">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unload measurements</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Unload measurements if they was not used in a pattern file.</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
@ -2004,8 +2019,8 @@
|
|||
<tabstop>toolButtonSplinePath</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="share/resources/toolicon.qrc"/>
|
||||
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
||||
<include location="share/resources/toolicon.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -457,12 +457,6 @@ QString VAbstractPattern::MPath() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetPath(const QString &path)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
{
|
||||
qDebug()<<"Path to measurements is empty"<<Q_FUNC_INFO;
|
||||
return;
|
||||
}
|
||||
|
||||
if (setTagText(TagMeasurements, path))
|
||||
{
|
||||
emit patternChanged(false);
|
||||
|
|
|
@ -691,8 +691,11 @@ bool VDomDocument::setTagText(const QString &tag, const QString &text)
|
|||
{
|
||||
QDomElement parent = domElement.parentNode().toElement();
|
||||
QDomElement newTag = createElement(tag);
|
||||
if (not text.isEmpty())
|
||||
{
|
||||
const QDomText newTagText = createTextNode(text);
|
||||
newTag.appendChild(newTagText);
|
||||
}
|
||||
|
||||
parent.replaceChild(newTag, domElement);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user