[Sketcher] Simplify general settings management
This commit is contained in:
committed by
abdullahtahiriyo
parent
2de7560489
commit
cd788bbd28
@@ -362,7 +362,7 @@ public:
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool avoidredundant = hGrp->GetBool("AvoidRedundantAutoconstraints",true);
|
||||
bool avoidredundant = hGrp->GetGroup("General")->GetBool("AvoidRedundantAutoconstraints",true);
|
||||
|
||||
if(avoidredundant)
|
||||
removeRedundantHorizontalVertical(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()),sugConstr1,sugConstr2);
|
||||
@@ -1167,7 +1167,7 @@ public:
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool avoidredundant = hGrp->GetBool("AvoidRedundantAutoconstraints",true);
|
||||
bool avoidredundant = hGrp->GetGroup("General")->GetBool("AvoidRedundantAutoconstraints",true);
|
||||
|
||||
if (Mode == STATUS_Close) {
|
||||
|
||||
|
||||
@@ -69,27 +69,22 @@ SketcherGeneralWidget::~SketcherGeneralWidget()
|
||||
|
||||
void SketcherGeneralWidget::saveSettings()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
|
||||
hGrp->SetBool("ShowGrid", ui->checkBoxShowGrid->isChecked());
|
||||
|
||||
ui->gridSize->pushToHistory();
|
||||
|
||||
hGrp->SetBool("GridSnap", ui->checkBoxGridSnap->isChecked());
|
||||
hGrp->SetBool("AutoConstraints", ui->checkBoxAutoconstraints->isChecked());
|
||||
ui->checkBoxShowGrid->onSave();
|
||||
ui->gridSize->onSave();
|
||||
ui->checkBoxGridSnap->onSave();
|
||||
ui->checkBoxAutoconstraints->onSave();
|
||||
ui->checkBoxRedundantAutoconstraints->onSave();
|
||||
|
||||
//not necessary to save renderOrder, as it is already stored in renderOrderChanged on every change.
|
||||
}
|
||||
|
||||
void SketcherGeneralWidget::loadSettings()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
|
||||
ui->checkBoxShowGrid->setChecked(hGrp->GetBool("ShowGrid", true));
|
||||
ui->gridSize->setParamGrpPath(QByteArray("User parameter:BaseApp/History/SketchGridSize"));
|
||||
ui->gridSize->setToLastUsedValue();
|
||||
ui->checkBoxGridSnap->setChecked(hGrp->GetBool("GridSnap", ui->checkBoxGridSnap->isChecked()));
|
||||
ui->checkBoxAutoconstraints->setChecked(hGrp->GetBool("AutoConstraints", ui->checkBoxAutoconstraints->isChecked()));
|
||||
ui->checkBoxShowGrid->onRestore();
|
||||
ui->gridSize->onRestore();
|
||||
ui->checkBoxGridSnap->onRestore();
|
||||
ui->checkBoxAutoconstraints->onRestore();
|
||||
ui->checkBoxRedundantAutoconstraints->onRestore();
|
||||
|
||||
ParameterGrp::handle hGrpp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
|
||||
@@ -112,8 +107,6 @@ void SketcherGeneralWidget::loadSettings()
|
||||
newItem->setData(Qt::UserRole, QVariant(lowid));
|
||||
newItem->setText(lowid==1?tr("Normal Geometry"):lowid==2?tr("Construction Geometry"):tr("External Geometry"));
|
||||
ui->renderingOrder->insertItem(2,newItem);
|
||||
|
||||
ui->checkBoxRedundantAutoconstraints->onRestore();
|
||||
}
|
||||
|
||||
void SketcherGeneralWidget::setGridSize(double val)
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxShowGrid">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxShowGrid">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>A grid will be shown</string>
|
||||
</property>
|
||||
@@ -23,7 +26,13 @@
|
||||
<string>Show grid</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ShowGrid</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -59,12 +68,18 @@
|
||||
<property name="value" stdset="0">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>GridSize</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher/General/GridSize</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxGridSnap">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxGridSnap">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -75,10 +90,16 @@ Points must be set closer than a fifth of the grid size to a grid line to snap.<
|
||||
<property name="text">
|
||||
<string>Grid snap</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>GridSnap</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxAutoconstraints">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxAutoconstraints">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -91,6 +112,12 @@ Points must be set closer than a fifth of the grid size to a grid line to snap.<
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>AutoConstraints</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -108,7 +135,7 @@ Points must be set closer than a fifth of the grid size to a grid line to snap.<
|
||||
<cstring>AvoidRedundantAutoconstraints</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher</cstring>
|
||||
<cstring>Mod/Sketcher/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user