added i18n for the origin
This commit is contained in:
@@ -129,10 +129,17 @@ App::DocumentObjectExecReturn *OriginGroupExtension::extensionExecute() {
|
||||
return GeoFeatureGroupExtension::extensionExecute ();
|
||||
}
|
||||
|
||||
App::DocumentObject *OriginGroupExtension::getLocalizedOrigin(App::Document *doc) {
|
||||
App::DocumentObject *originObject = doc->addObject ( "App::Origin", "Origin" );
|
||||
QByteArray byteArray = tr("Origin").toUtf8();
|
||||
originObject->Label.setValue(byteArray.constData());
|
||||
return originObject;
|
||||
}
|
||||
|
||||
void OriginGroupExtension::onExtendedSetupObject () {
|
||||
App::Document *doc = getExtendedObject()->getDocument ();
|
||||
|
||||
App::DocumentObject *originObj = doc->addObject ( "App::Origin", "Origin" );
|
||||
App::DocumentObject *originObj = getLocalizedOrigin(doc);
|
||||
|
||||
assert ( originObj && originObj->isDerivedFrom ( App::Origin::getClassTypeId () ) );
|
||||
Origin.setValue (originObj);
|
||||
@@ -160,10 +167,11 @@ void OriginGroupExtension::extensionOnChanged(const Property* p) {
|
||||
&& owner->getDocument()->testStatus(Document::Importing)) {
|
||||
for (auto o : origin->getInList()) {
|
||||
if(o != owner && o->hasExtension(App::OriginGroupExtension::getExtensionClassTypeId())) {
|
||||
App::Document *document = owner->getDocument();
|
||||
// Temporarily reset 'Restoring' status to allow document to auto label new objects
|
||||
Base::ObjectStatusLocker<Document::Status, Document> guard(
|
||||
Document::Restoring, owner->getDocument(), false);
|
||||
Origin.setValue(owner->getDocument()->addObject("App::Origin", "Origin"));
|
||||
Document::Restoring, document, false);
|
||||
Origin.setValue(getLocalizedOrigin(document));
|
||||
FC_WARN("Reset origin in " << owner->getFullName());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define ORIGINGROUP_H_QHTU73IF
|
||||
|
||||
#include "GeoFeatureGroupExtension.h"
|
||||
#include "QCoreApplication"
|
||||
|
||||
namespace App {
|
||||
class Origin;
|
||||
@@ -34,6 +35,7 @@ class Origin;
|
||||
class AppExport OriginGroupExtension : public App::GeoFeatureGroupExtension
|
||||
{
|
||||
EXTENSION_PROPERTY_HEADER_WITH_OVERRIDE(App::OriginGroupExtension);
|
||||
Q_DECLARE_TR_FUNCTIONS(App::OriginGroupExtension)
|
||||
|
||||
public:
|
||||
OriginGroupExtension ();
|
||||
@@ -78,6 +80,10 @@ protected:
|
||||
void onExtendedSetupObject () override;
|
||||
/// Removes all planes and axis if they are still linked to the document
|
||||
void onExtendedUnsetupObject () override;
|
||||
|
||||
private:
|
||||
/// Creates a localized Origin object
|
||||
App::DocumentObject *getLocalizedOrigin(App::Document *doc);
|
||||
};
|
||||
|
||||
using OriginGroupExtensionPython = ExtensionPythonT<GroupExtensionPythonT<OriginGroupExtension>>;
|
||||
|
||||
Reference in New Issue
Block a user