PartDesign: Issue #0004473: Expose openCommand() to translation

Continuing the work to expose the undo/redo functionality to translation. This commit does so for the PartDesign Wb.  
Ticket: https://tracker.freecadweb.org/view.php?id=4473
This commit is contained in:
luz paz
2020-11-27 20:55:34 -05:00
committed by wwmayer
parent 5aff8cdd0b
commit faa8688ee5
6 changed files with 23 additions and 23 deletions

View File

@@ -296,7 +296,7 @@ void CmdPartDesignShapeBinder::activated(int iMsg)
}
if (bEditSelected) {
openCommand("Edit ShapeBinder");
openCommand(QT_TRANSLATE_NOOP("Command", "Edit ShapeBinder"));
PartDesignGui::setEdit(support.getValue());
} else {
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */true);
@@ -305,7 +305,7 @@ void CmdPartDesignShapeBinder::activated(int iMsg)
std::string FeatName = getUniqueObjectName("ShapeBinder",pcActiveBody);
openCommand("Create ShapeBinder");
openCommand(QT_TRANSLATE_NOOP("Command", "Create ShapeBinder"));
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::ShapeBinder','" << FeatName << "')");
// remove the body from links in case it's selected as
@@ -387,7 +387,7 @@ void CmdPartDesignSubShapeBinder::activated(int iMsg)
PartDesign::SubShapeBinder *binder = 0;
try {
openCommand("Create SubShapeBinder");
openCommand(QT_TRANSLATE_NOOP("Command", "Create SubShapeBinder"));
if (pcActiveBody) {
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::SubShapeBinder','" << FeatName << "')");
binder = dynamic_cast<PartDesign::SubShapeBinder*>(pcActiveBody->getObject(FeatName.c_str()));
@@ -441,7 +441,7 @@ void CmdPartDesignClone::activated(int iMsg)
// put the clone into its own new body.
// This also fixes bug #3447 because the clone is a PD feature and thus
// requires a body where it is part of.
openCommand("Create Clone");
openCommand(QT_TRANSLATE_NOOP("Command", "Create Clone"));
auto obj = objs[0];
std::string FeatName = getUniqueObjectName("Clone",obj);
std::string BodyName = getUniqueObjectName("Body",obj);
@@ -635,7 +635,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
if (result == QDialog::DialogCode::Rejected)
return;
else if (!dlg.radioXRef->isChecked()) {
openCommand("Make copy");
openCommand(QT_TRANSLATE_NOOP("Command", "Make copy"));
std::string sub;
if (FaceFilter.match())
sub = FaceFilter.Result[0][0].getSubNames()[0];
@@ -659,7 +659,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
// create Sketch on Face or Plane
std::string FeatName = getUniqueObjectName("Sketch",pcActiveBody);
openCommand("Create a Sketch on Face");
openCommand(QT_TRANSLATE_NOOP("Command", "Create a Sketch on Face"));
FCMD_OBJ_CMD(pcActiveBody,"newObject('Sketcher::SketchObject','" << FeatName << "')");
auto Feat = pcActiveBody->getDocument()->getObject(FeatName.c_str());
FCMD_OBJ_CMD(Feat,"Support = " << supportString);
@@ -680,7 +680,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
std::vector<PartDesignGui::TaskFeaturePick::featureStatus> status;
// Start command early, so undo will undo any Body creation
Gui::Command::openCommand("Create a new Sketch");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create a new Sketch"));
if (shouldMakeBody) {
pcActiveBody = PartDesignGui::makeBody(doc);
if ( !pcActiveBody ) {
@@ -1115,7 +1115,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
return;
if (!dlg.radioXRef->isChecked()) {
Gui::Command::openCommand("Make copy");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Make copy"));
auto copy = PartDesignGui::TaskFeaturePick::makeCopy(sketches[0], "", dlg.radioIndependent->isChecked());
auto oBody = PartDesignGui::getBodyFor(sketches[0], false);
if (oBody)
@@ -2302,7 +2302,7 @@ void CmdPartDesignMultiTransform::activated(int iMsg)
if (prevFeature != NULL)
Gui::Selection().addSelection(prevFeature->getDocument()->getName(), prevFeature->getNameInDocument());
openCommand("Convert to MultiTransform feature");
openCommand(QT_TRANSLATE_NOOP("Command", "Convert to MultiTransform feature"));
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.runCommandByName("PartDesign_MoveTip");
@@ -2393,7 +2393,7 @@ void CmdPartDesignBoolean::activated(int iMsg)
Gui::SelectionFilter BodyFilter("SELECT Part::Feature COUNT 1..");
openCommand("Create Boolean");
openCommand(QT_TRANSLATE_NOOP("Command", "Create Boolean"));
std::string FeatName = getUniqueObjectName("Boolean",pcActiveBody);
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::Boolean','"<<FeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(FeatName.c_str());

View File

@@ -192,7 +192,7 @@ void CmdPartDesignBody::activated(int iMsg)
}
openCommand("Add a Body");
openCommand(QT_TRANSLATE_NOOP("Command", "Add a Body"));
std::string bodyName = getUniqueObjectName("Body");
@@ -428,7 +428,7 @@ void CmdPartDesignMigrate::activated(int iMsg)
}
// do the actual migration
Gui::Command::openCommand("Migrate legacy part design features to Bodies");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Migrate legacy part design features to Bodies"));
for ( auto chainIt = featureChains.begin(); !featureChains.empty();
featureChains.erase (chainIt), chainIt = featureChains.begin () ) {
@@ -573,7 +573,7 @@ void CmdPartDesignMoveTip::activated(int iMsg)
return;
}
openCommand("Move tip to selected feature");
openCommand(QT_TRANSLATE_NOOP("Command", "Move tip to selected feature"));
if (selFeature == body) {
FCMD_OBJ_CMD(body,"Tip = None");
@@ -618,7 +618,7 @@ void CmdPartDesignDuplicateSelection::activated(int iMsg)
std::vector<App::DocumentObject*> beforeFeatures = getDocument()->getObjects();
openCommand("Duplicate a PartDesign object");
openCommand(QT_TRANSLATE_NOOP("Command", "Duplicate a PartDesign object"));
doCommand(Doc,"FreeCADGui.runCommand('Std_DuplicateSelection')");
if (pcActiveBody) {
@@ -736,7 +736,7 @@ void CmdPartDesignMoveFeature::activated(int iMsg)
PartDesign::Body* target = static_cast<PartDesign::Body*>(target_bodies[index]);
openCommand("Move an object");
openCommand(QT_TRANSLATE_NOOP("Command", "Move an object"));
std::stringstream stream;
stream << "features_ = [" << getObjectCmd(features.back());
@@ -885,7 +885,7 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
// first object is the beginning of the body
App::DocumentObject* target = index != 0 ? model[index-1] : nullptr;
openCommand("Move an object inside tree");
openCommand(QT_TRANSLATE_NOOP("Command", "Move an object inside tree"));
App::DocumentObject* lastObject = nullptr;
for ( auto feat: features ) {

View File

@@ -332,7 +332,7 @@ void TaskChamferParameters::apply()
{
std::string name = DressUpView->getObject()->getNameInDocument();
//Gui::Command::openCommand("Chamfer changed");
//Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Chamfer changed"));
PartDesign::Chamfer* pcChamfer = static_cast<PartDesign::Chamfer*>(DressUpView->getObject());

View File

@@ -235,7 +235,7 @@ void TaskFilletParameters::apply()
{
std::string name = getDressUpView()->getObject()->getNameInDocument();
//Gui::Command::openCommand("Fillet changed");
//Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Fillet changed"));
ui->filletRadius->apply();
}

View File

@@ -288,7 +288,7 @@ void TaskMultiTransformParameters::onTransformAddMirrored()
auto pcActiveBody = PartDesignGui::getBody(false);
if(!pcActiveBody) return;
Gui::Command::openCommand("Mirrored");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Mirrored"));
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::Mirrored','"<<newFeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(newFeatName.c_str());
//Gui::Command::updateActive();
@@ -308,7 +308,7 @@ void TaskMultiTransformParameters::onTransformAddLinearPattern()
auto pcActiveBody = PartDesignGui::getBody(false);
if(!pcActiveBody) return;
Gui::Command::openCommand("Make LinearPattern");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Make LinearPattern"));
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::LinearPattern','"<<newFeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(newFeatName.c_str());
//Gui::Command::updateActive();
@@ -338,7 +338,7 @@ void TaskMultiTransformParameters::onTransformAddPolarPattern()
auto pcActiveBody = PartDesignGui::getBody(false);
if(!pcActiveBody) return;
Gui::Command::openCommand("PolarPattern");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "PolarPattern"));
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::PolarPattern','"<<newFeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(newFeatName.c_str());
//Gui::Command::updateActive();
@@ -358,7 +358,7 @@ void TaskMultiTransformParameters::onTransformAddScaled()
auto pcActiveBody = PartDesignGui::getBody(false);
if(!pcActiveBody) return;
Gui::Command::openCommand("Scaled");
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Scaled"));
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::Scaled','"<<newFeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(newFeatName.c_str());
//Gui::Command::updateActive();

View File

@@ -396,7 +396,7 @@ void TaskRevolutionParameters::changeEvent(QEvent *e)
void TaskRevolutionParameters::apply()
{
//Gui::Command::openCommand("Revolution changed");
//Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Revolution changed"));
ui->revolveAngle->apply();
std::vector<std::string> sub;
App::DocumentObject* obj;