mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
setProjectTranslator
...in QgsReadWriteContext creation implementation of projectTranslator where needed use of DefaultTranslator to have default translation funtion derived from QgsProjectTranslator beautify code
This commit is contained in:
parent
fc018daa3f
commit
090db0d86b
@ -352,7 +352,6 @@
|
|||||||
%Include auto_generated/qgssnappingconfig.sip
|
%Include auto_generated/qgssnappingconfig.sip
|
||||||
%Include auto_generated/qgstaskmanager.sip
|
%Include auto_generated/qgstaskmanager.sip
|
||||||
%Include auto_generated/qgstolerance.sip
|
%Include auto_generated/qgstolerance.sip
|
||||||
%Include auto_generated/qgstranslationcontext.sip
|
|
||||||
%Include auto_generated/qgstrackedvectorlayertools.sip
|
%Include auto_generated/qgstrackedvectorlayertools.sip
|
||||||
%Include auto_generated/qgstransaction.sip
|
%Include auto_generated/qgstransaction.sip
|
||||||
%Include auto_generated/qgstransactiongroup.sip
|
%Include auto_generated/qgstransactiongroup.sip
|
||||||
@ -367,6 +366,7 @@
|
|||||||
%Include auto_generated/qgsvectorlayertools.sip
|
%Include auto_generated/qgsvectorlayertools.sip
|
||||||
%Include auto_generated/qgsvectorsimplifymethod.sip
|
%Include auto_generated/qgsvectorsimplifymethod.sip
|
||||||
%Include auto_generated/qgssettings.sip
|
%Include auto_generated/qgssettings.sip
|
||||||
|
%Include auto_generated/qgsprojecttranslator.sip
|
||||||
%Include auto_generated/annotations/qgsannotation.sip
|
%Include auto_generated/annotations/qgsannotation.sip
|
||||||
%Include auto_generated/annotations/qgsannotationmanager.sip
|
%Include auto_generated/annotations/qgsannotationmanager.sip
|
||||||
%Include auto_generated/annotations/qgshtmlannotation.sip
|
%Include auto_generated/annotations/qgshtmlannotation.sip
|
||||||
@ -442,4 +442,5 @@
|
|||||||
%Include auto_generated/layertree/qgslayertreeregistrybridge.sip
|
%Include auto_generated/layertree/qgslayertreeregistrybridge.sip
|
||||||
%Include auto_generated/qgsuserprofilemanager.sip
|
%Include auto_generated/qgsuserprofilemanager.sip
|
||||||
%Include auto_generated/symbology/qgsarrowsymbollayer.sip
|
%Include auto_generated/symbology/qgsarrowsymbollayer.sip
|
||||||
|
%Include auto_generated/qgstranslationcontext.sip
|
||||||
%Include auto_generated/qgsuserprofile.sip
|
%Include auto_generated/qgsuserprofile.sip
|
||||||
|
@ -831,24 +831,23 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
|
|||||||
connect( titleEdit, &QLineEdit::textChanged, mMetadataWidget, &QgsMetadataWidget::setTitle );
|
connect( titleEdit, &QLineEdit::textChanged, mMetadataWidget, &QgsMetadataWidget::setTitle );
|
||||||
|
|
||||||
//fill ts language checkbox
|
//fill ts language checkbox
|
||||||
//could possibly be taken from QgsOptions
|
//fill ts language checkbox
|
||||||
QString myI18nPath = QgsApplication::i18nPath();
|
QString i18nPath = QgsApplication::i18nPath();
|
||||||
QDir myDir( myI18nPath, QStringLiteral( "qgis*.qm" ) );
|
QDir i18Dir( i18nPath, QStringLiteral( "qgis*.qm" ) );
|
||||||
QStringList myFileList = myDir.entryList();
|
const QStringList qmFileList = i18Dir.entryList();
|
||||||
QStringListIterator myIterator( myFileList );
|
for ( const QString &qmFile : qmFileList )
|
||||||
while ( myIterator.hasNext() )
|
|
||||||
{
|
{
|
||||||
QString myFileName = myIterator.next();
|
|
||||||
|
|
||||||
// Ignore the 'en' translation file, already added as 'en_US'.
|
// Ignore the 'en' translation file, already added as 'en_US'.
|
||||||
if ( myFileName.compare( QLatin1String( "qgis_en.qm" ) ) == 0 ) continue;
|
if ( qmFile.compare( QLatin1String( "qgis_en.qm" ) ) == 0 ) continue;
|
||||||
|
|
||||||
QString l = myFileName.remove( QStringLiteral( "qgis_" ) ).remove( QStringLiteral( ".qm" ) );
|
QString qmFileName = qmFile;
|
||||||
|
QString l = qmFileName.remove( QStringLiteral( "qgis_" ) ).remove( QStringLiteral( ".qm" ) );
|
||||||
|
|
||||||
// QTBUG-57802: eo locale is improperly handled
|
// QTBUG-57802: eo locale is improperly handled
|
||||||
QString displayName = l.startsWith( QLatin1String( "eo" ) ) ? QLocale::languageToString( QLocale::Esperanto ) : QLocale( l ).nativeLanguageName();
|
QString displayName = l.startsWith( QLatin1String( "eo" ) ) ? QLocale::languageToString( QLocale::Esperanto ) : QLocale( l ).nativeLanguageName();
|
||||||
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l );
|
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l );
|
||||||
}
|
}
|
||||||
|
|
||||||
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( QStringLiteral( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
|
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( QStringLiteral( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
|
||||||
cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) );
|
cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) );
|
||||||
|
|
||||||
|
@ -657,6 +657,7 @@ SET(QGIS_CORE_MOC_HDRS
|
|||||||
qgswebpage.h
|
qgswebpage.h
|
||||||
qgswebview.h
|
qgswebview.h
|
||||||
qgssettings.h
|
qgssettings.h
|
||||||
|
qgsprojecttranslator.h
|
||||||
|
|
||||||
annotations/qgsannotation.h
|
annotations/qgsannotation.h
|
||||||
annotations/qgsannotationmanager.h
|
annotations/qgsannotationmanager.h
|
||||||
|
@ -255,7 +255,8 @@ QgsLayerTreeGroup *QgsLayerTreeGroup::findGroup( const QString &name )
|
|||||||
QList<QgsLayerTreeGroup *> QgsLayerTreeGroup::findGroups() const
|
QList<QgsLayerTreeGroup *> QgsLayerTreeGroup::findGroups() const
|
||||||
{
|
{
|
||||||
QList<QgsLayerTreeGroup *> list;
|
QList<QgsLayerTreeGroup *> list;
|
||||||
Q_FOREACH ( QgsLayerTreeNode *child, mChildren )
|
|
||||||
|
for ( QgsLayerTreeNode *child : mChildren )
|
||||||
{
|
{
|
||||||
if ( QgsLayerTree::isGroup( child ) )
|
if ( QgsLayerTree::isGroup( child ) )
|
||||||
list << QgsLayerTree::toGroup( child );
|
list << QgsLayerTree::toGroup( child );
|
||||||
|
@ -65,6 +65,7 @@ QgsLayerTreeNode *QgsLayerTreeNode::readXml( QDomElement &element, const QgsProj
|
|||||||
if ( project )
|
if ( project )
|
||||||
resolver = project->pathResolver();
|
resolver = project->pathResolver();
|
||||||
context.setPathResolver( resolver );
|
context.setPathResolver( resolver );
|
||||||
|
context.setProjectTranslator( ( QgsProject * )project );
|
||||||
|
|
||||||
QgsLayerTreeNode *node = readXml( element, context );
|
QgsLayerTreeNode *node = readXml( element, context );
|
||||||
if ( node )
|
if ( node )
|
||||||
|
@ -1193,6 +1193,7 @@ bool QgsCompositionConverter::readLegendXml( QgsLayoutItemLegend *layoutItem, co
|
|||||||
pathResolver = project->pathResolver();
|
pathResolver = project->pathResolver();
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( pathResolver );
|
context.setPathResolver( pathResolver );
|
||||||
|
context.setProjectTranslator( ( QgsProject * )project );
|
||||||
|
|
||||||
//composer map: use uuid
|
//composer map: use uuid
|
||||||
QString mapId = itemElem.attribute( QStringLiteral( "map" ), QStringLiteral( "-1" ) );
|
QString mapId = itemElem.attribute( QStringLiteral( "map" ), QStringLiteral( "-1" ) );
|
||||||
|
@ -51,6 +51,7 @@ bool QgsLayerDefinition::loadLayerDefinition( const QString &path, QgsProject *p
|
|||||||
|
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( QgsPathResolver( path ) );
|
context.setPathResolver( QgsPathResolver( path ) );
|
||||||
|
context.setProjectTranslator( project );
|
||||||
|
|
||||||
return loadLayerDefinition( doc, project, rootGroup, errorMessage, context );
|
return loadLayerDefinition( doc, project, rootGroup, errorMessage, context );
|
||||||
}
|
}
|
||||||
@ -298,6 +299,7 @@ QList<QgsMapLayer *> QgsLayerDefinition::loadLayerDefinitionLayers( const QStrin
|
|||||||
|
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( QgsPathResolver( qlrfile ) );
|
context.setPathResolver( QgsPathResolver( qlrfile ) );
|
||||||
|
//no projecttranslator defined here
|
||||||
return QgsLayerDefinition::loadLayerDefinitionLayers( doc, context );
|
return QgsLayerDefinition::loadLayerDefinitionLayers( doc, context );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,6 +861,7 @@ bool QgsProject::_getMapLayers( const QDomDocument &doc, QList<QDomNode> &broken
|
|||||||
{
|
{
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( pathResolver() );
|
context.setPathResolver( pathResolver() );
|
||||||
|
context.setProjectTranslator( this );
|
||||||
if ( !addLayer( element, brokenNodes, context ) )
|
if ( !addLayer( element, brokenNodes, context ) )
|
||||||
{
|
{
|
||||||
returnStatus = false;
|
returnStatus = false;
|
||||||
@ -960,6 +961,7 @@ bool QgsProject::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
|
context.setProjectTranslator( this );
|
||||||
if ( !storage->readProject( filename, &inDevice, context ) )
|
if ( !storage->readProject( filename, &inDevice, context ) )
|
||||||
{
|
{
|
||||||
QString err = tr( "Unable to open %1" ).arg( filename );
|
QString err = tr( "Unable to open %1" ).arg( filename );
|
||||||
@ -1107,6 +1109,7 @@ bool QgsProject::readProjectFile( const QString &filename )
|
|||||||
|
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( pathResolver() );
|
context.setPathResolver( pathResolver() );
|
||||||
|
context.setProjectTranslator( this );
|
||||||
|
|
||||||
//crs
|
//crs
|
||||||
QgsCoordinateReferenceSystem projectCrs;
|
QgsCoordinateReferenceSystem projectCrs;
|
||||||
@ -1302,7 +1305,7 @@ bool QgsProject::readProjectFile( const QString &filename )
|
|||||||
emit ellipsoidChanged( ellipsoid() );
|
emit ellipsoidChanged( ellipsoid() );
|
||||||
|
|
||||||
// read the project: used by map canvas and legend
|
// read the project: used by map canvas and legend
|
||||||
emit readProject( *doc );
|
emit readProject( *doc, context );
|
||||||
emit snappingConfigChanged( mSnappingConfig );
|
emit snappingConfigChanged( mSnappingConfig );
|
||||||
|
|
||||||
// if all went well, we're allegedly in pristine state
|
// if all went well, we're allegedly in pristine state
|
||||||
@ -1537,6 +1540,7 @@ bool QgsProject::readLayer( const QDomNode &layerNode )
|
|||||||
{
|
{
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( pathResolver() );
|
context.setPathResolver( pathResolver() );
|
||||||
|
context.setProjectTranslator( this );
|
||||||
QList<QDomNode> brokenNodes;
|
QList<QDomNode> brokenNodes;
|
||||||
if ( addLayer( layerNode.toElement(), brokenNodes, context ) )
|
if ( addLayer( layerNode.toElement(), brokenNodes, context ) )
|
||||||
{
|
{
|
||||||
@ -2151,6 +2155,7 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
|
|||||||
QgsReadWriteContext embeddedContext;
|
QgsReadWriteContext embeddedContext;
|
||||||
if ( !useAbsolutePaths )
|
if ( !useAbsolutePaths )
|
||||||
embeddedContext.setPathResolver( QgsPathResolver( projectFilePath ) );
|
embeddedContext.setPathResolver( QgsPathResolver( projectFilePath ) );
|
||||||
|
embeddedContext.setProjectTranslator( this );
|
||||||
|
|
||||||
QDomElement projectLayersElem = sProjectDocument.documentElement().firstChildElement( QStringLiteral( "projectlayers" ) );
|
QDomElement projectLayersElem = sProjectDocument.documentElement().firstChildElement( QStringLiteral( "projectlayers" ) );
|
||||||
if ( projectLayersElem.isNull() )
|
if ( projectLayersElem.isNull() )
|
||||||
@ -2207,6 +2212,7 @@ QgsLayerTreeGroup *QgsProject::createEmbeddedGroup( const QString &groupName, co
|
|||||||
|
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
context.setPathResolver( pathResolver() );
|
context.setPathResolver( pathResolver() );
|
||||||
|
context.setProjectTranslator( this );
|
||||||
|
|
||||||
// store identify disabled layers of the embedded project
|
// store identify disabled layers of the embedded project
|
||||||
QSet<QString> embeddedIdentifyDisabledLayers;
|
QSet<QString> embeddedIdentifyDisabledLayers;
|
||||||
|
@ -997,7 +997,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
|
|||||||
/**
|
/**
|
||||||
* Emitted when a project is being read.
|
* Emitted when a project is being read.
|
||||||
*/
|
*/
|
||||||
void readProject( const QDomDocument & );
|
void readProject( const QDomDocument &, QgsReadWriteContext &context );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when the project is being written.
|
* Emitted when the project is being written.
|
||||||
|
@ -37,6 +37,7 @@ class CORE_EXPORT QgsProjectTranslator
|
|||||||
*
|
*
|
||||||
* \since QGIS 3.4
|
* \since QGIS 3.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual QString translate( const QString &context, const QString &sourceText, const char *disambiguation = nullptr, int n = -1 ) const = 0;
|
virtual QString translate( const QString &context, const QString &sourceText, const char *disambiguation = nullptr, int n = -1 ) const = 0;
|
||||||
|
|
||||||
virtual ~QgsProjectTranslator() = default;
|
virtual ~QgsProjectTranslator() = default;
|
||||||
|
@ -14,6 +14,12 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "qgsreadwritecontext.h"
|
#include "qgsreadwritecontext.h"
|
||||||
|
|
||||||
|
QgsReadWriteContext::QgsReadWriteContext()
|
||||||
|
: mProjectTranslator( &mDefaultTranslator )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QgsReadWriteContext::~QgsReadWriteContext()
|
QgsReadWriteContext::~QgsReadWriteContext()
|
||||||
{
|
{
|
||||||
// be sure that categories have been emptied
|
// be sure that categories have been emptied
|
||||||
@ -50,9 +56,22 @@ void QgsReadWriteContext::leaveCategory()
|
|||||||
mCategories.pop_back();
|
mCategories.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsReadWriteContext::setProjectTranslator( QgsProjectTranslator *projectTranslator )
|
||||||
|
{
|
||||||
|
mProjectTranslator = projectTranslator;
|
||||||
|
}
|
||||||
|
|
||||||
QList<QgsReadWriteContext::ReadWriteMessage > QgsReadWriteContext::takeMessages()
|
QList<QgsReadWriteContext::ReadWriteMessage > QgsReadWriteContext::takeMessages()
|
||||||
{
|
{
|
||||||
QList<QgsReadWriteContext::ReadWriteMessage > messages = mMessages;
|
QList<QgsReadWriteContext::ReadWriteMessage > messages = mMessages;
|
||||||
mMessages.clear();
|
mMessages.clear();
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QgsReadWriteContext::DefaultTranslator::translate( const QString &context, const QString &sourceText, const char *disambiguation, int n ) const
|
||||||
|
{
|
||||||
|
Q_UNUSED( context );
|
||||||
|
Q_UNUSED( disambiguation );
|
||||||
|
Q_UNUSED( n );
|
||||||
|
return sourceText;
|
||||||
|
}
|
||||||
|
@ -65,7 +65,7 @@ class CORE_EXPORT QgsReadWriteContext
|
|||||||
/**
|
/**
|
||||||
* Constructor for QgsReadWriteContext.
|
* Constructor for QgsReadWriteContext.
|
||||||
*/
|
*/
|
||||||
QgsReadWriteContext() = default;
|
QgsReadWriteContext();
|
||||||
|
|
||||||
~QgsReadWriteContext();
|
~QgsReadWriteContext();
|
||||||
|
|
||||||
@ -106,7 +106,17 @@ class CORE_EXPORT QgsReadWriteContext
|
|||||||
*/
|
*/
|
||||||
const QgsProjectTranslator *projectTranslator( ) const { return mProjectTranslator; }
|
const QgsProjectTranslator *projectTranslator( ) const { return mProjectTranslator; }
|
||||||
|
|
||||||
|
void setProjectTranslator( QgsProjectTranslator *projectTranslator );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
class DefaultTranslator : public QgsProjectTranslator
|
||||||
|
{
|
||||||
|
// QgsProjectTranslator interface
|
||||||
|
public:
|
||||||
|
QString translate( const QString &context, const QString &sourceText, const char *disambiguation, int n ) const;
|
||||||
|
};
|
||||||
|
|
||||||
//! Pop the last category
|
//! Pop the last category
|
||||||
void leaveCategory();
|
void leaveCategory();
|
||||||
|
|
||||||
@ -114,8 +124,8 @@ class CORE_EXPORT QgsReadWriteContext
|
|||||||
QList<ReadWriteMessage> mMessages;
|
QList<ReadWriteMessage> mMessages;
|
||||||
QStringList mCategories = QStringList();
|
QStringList mCategories = QStringList();
|
||||||
QgsProjectTranslator *mProjectTranslator;
|
QgsProjectTranslator *mProjectTranslator;
|
||||||
|
|
||||||
friend class QgsReadWriteContextCategoryPopper;
|
friend class QgsReadWriteContextCategoryPopper;
|
||||||
|
DefaultTranslator mDefaultTranslator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "qgsproject.h"
|
#include "qgsproject.h"
|
||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
|
|
||||||
QgsRelation QgsRelation::createFromXml( const QDomNode &node )
|
QgsRelation QgsRelation::createFromXml( const QDomNode &node, QgsReadWriteContext &context )
|
||||||
{
|
{
|
||||||
QDomElement elem = node.toElement();
|
QDomElement elem = node.toElement();
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ QgsRelation QgsRelation::createFromXml( const QDomNode &node )
|
|||||||
QString referencingLayerId = elem.attribute( QStringLiteral( "referencingLayer" ) );
|
QString referencingLayerId = elem.attribute( QStringLiteral( "referencingLayer" ) );
|
||||||
QString referencedLayerId = elem.attribute( QStringLiteral( "referencedLayer" ) );
|
QString referencedLayerId = elem.attribute( QStringLiteral( "referencedLayer" ) );
|
||||||
QString id = elem.attribute( QStringLiteral( "id" ) );
|
QString id = elem.attribute( QStringLiteral( "id" ) );
|
||||||
QString name = QgsProject::instance()->translate( QStringLiteral( "project:relations" ), elem.attribute( QStringLiteral( "name" ) ) );
|
QString name = context.projectTranslator()->translate( QStringLiteral( "project:relations" ), elem.attribute( QStringLiteral( "name" ) ) );
|
||||||
QString strength = elem.attribute( QStringLiteral( "strength" ) );
|
QString strength = elem.attribute( QStringLiteral( "strength" ) );
|
||||||
|
|
||||||
const QMap<QString, QgsMapLayer *> &mapLayers = QgsProject::instance()->mapLayers();
|
const QMap<QString, QgsMapLayer *> &mapLayers = QgsProject::instance()->mapLayers();
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
#include "qgsfields.h"
|
#include "qgsfields.h"
|
||||||
|
#include "qgsreadwritecontext.h"
|
||||||
|
|
||||||
#include "qgis.h"
|
#include "qgis.h"
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ class CORE_EXPORT QgsRelation
|
|||||||
*
|
*
|
||||||
* \returns A relation
|
* \returns A relation
|
||||||
*/
|
*/
|
||||||
static QgsRelation createFromXml( const QDomNode &node );
|
static QgsRelation createFromXml( const QDomNode &node, QgsReadWriteContext &context );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a relation to an XML structure. Used for saving .qgs projects
|
* Writes a relation to an XML structure. Used for saving .qgs projects
|
||||||
|
@ -153,7 +153,7 @@ QList<QgsRelation> QgsRelationManager::referencedRelations( QgsVectorLayer *laye
|
|||||||
return relations;
|
return relations;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsRelationManager::readProject( const QDomDocument &doc )
|
void QgsRelationManager::readProject( const QDomDocument &doc, QgsReadWriteContext &context )
|
||||||
{
|
{
|
||||||
mRelations.clear();
|
mRelations.clear();
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ void QgsRelationManager::readProject( const QDomDocument &doc )
|
|||||||
int relCount = relationNodes.count();
|
int relCount = relationNodes.count();
|
||||||
for ( int i = 0; i < relCount; ++i )
|
for ( int i = 0; i < relCount; ++i )
|
||||||
{
|
{
|
||||||
addRelation( QgsRelation::createFromXml( relationNodes.at( i ) ) );
|
addRelation( QgsRelation::createFromXml( relationNodes.at( i ), context ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -142,7 +142,7 @@ class CORE_EXPORT QgsRelationManager : public QObject
|
|||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void readProject( const QDomDocument &doc );
|
void readProject( const QDomDocument &doc, QgsReadWriteContext &context );
|
||||||
void writeProject( QDomDocument &doc );
|
void writeProject( QDomDocument &doc );
|
||||||
void layersRemoved( const QStringList &layers );
|
void layersRemoved( const QStringList &layers );
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void QgsTranslationContext::writeTsFile( const QString &locale )
|
|||||||
tsElement.setAttribute( QStringLiteral( "sourcelanguage" ), settings.value( QStringLiteral( "locale/userLocale" ), "" ).toString() );
|
tsElement.setAttribute( QStringLiteral( "sourcelanguage" ), settings.value( QStringLiteral( "locale/userLocale" ), "" ).toString() );
|
||||||
doc.appendChild( tsElement );
|
doc.appendChild( tsElement );
|
||||||
|
|
||||||
for ( TranslatableObject translatableObject : mTranslatableObjects )
|
for ( const TranslatableObject &translatableObject : mTranslatableObjects )
|
||||||
{
|
{
|
||||||
QDomElement contextElement = doc.createElement( QStringLiteral( "context" ) );
|
QDomElement contextElement = doc.createElement( QStringLiteral( "context" ) );
|
||||||
tsElement.appendChild( contextElement );
|
tsElement.appendChild( contextElement );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user